Skip to content

Commit 6e35d13

Browse files
authored
Merge pull request #256 from koic/remove_dead_code_in_handle_regular_request
Remove dead code in `handle_regular_request`
2 parents 628e520 + 9d9a134 commit 6e35d13

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

lib/mcp/server/transports/streamable_http_transport.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,25 +265,18 @@ def handle_regular_request(body_string, session_id)
265265
end
266266
end
267267

268-
response = @server.handle_json(body_string) || ""
268+
response = @server.handle_json(body_string)
269269

270270
# Stream can be nil since stateless mode doesn't retain streams
271271
stream = get_session_stream(session_id) if session_id
272272

273273
if stream
274274
send_response_to_stream(stream, response, session_id)
275-
elsif response.nil? && notification_request?(body_string)
276-
[202, { "Content-Type" => "application/json" }, [response]]
277275
else
278276
[200, { "Content-Type" => "application/json" }, [response]]
279277
end
280278
end
281279

282-
def notification_request?(body_string)
283-
body = parse_request_body(body_string)
284-
body.is_a?(Hash) && body["method"].start_with?("notifications/")
285-
end
286-
287280
def get_session_stream(session_id)
288281
@mutex.synchronize { @sessions[session_id]&.fetch(:stream, nil) }
289282
end

0 commit comments

Comments
 (0)