Skip to content

Commit 1ddd26b

Browse files
committed
Remove redundant respond_to?(:flush) guard in StreamableHTTPTransport
## Motivation and Context The stream object always responds to flush, so the conditional check is unnecessary. ## How Has This Been Tested? All existing tests are passing. ## Breaking Changes None.
1 parent 2a1c9b7 commit 1ddd26b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/mcp/server/transports/streamable_http_transport.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,12 @@ def reap_expired_sessions
255255
def send_to_stream(stream, data)
256256
message = data.is_a?(String) ? data : data.to_json
257257
stream.write("data: #{message}\n\n")
258-
stream.flush if stream.respond_to?(:flush)
258+
stream.flush
259259
end
260260

261261
def send_ping_to_stream(stream)
262262
stream.write(": ping #{Time.now.iso8601}\n\n")
263-
stream.flush if stream.respond_to?(:flush)
263+
stream.flush
264264
end
265265

266266
def handle_post(request)

0 commit comments

Comments
 (0)