Skip to content

Commit e816b33

Browse files
committed
Refactor handle_delete to use extract_session_id and missing_session_id_response
`handle_post` and `handle_get` already use these helper methods, but `handle_delete` inlined the same logic. This aligns all three handlers to use the shared helpers consistently.
1 parent f4aab5c commit e816b33

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

lib/mcp/server/transports/streamable_http_transport.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,9 @@ def handle_delete(request)
154154
return success_response
155155
end
156156

157-
session_id = request.env["HTTP_MCP_SESSION_ID"]
157+
session_id = extract_session_id(request)
158158

159-
return [
160-
400,
161-
{ "Content-Type" => "application/json" },
162-
[{ error: "Missing session ID" }.to_json],
163-
] unless session_id
159+
return missing_session_id_response unless session_id
164160

165161
cleanup_session(session_id)
166162
success_response

0 commit comments

Comments
 (0)