From 0a8137a92790f9a1466cc949d5c01c5104268bad Mon Sep 17 00:00:00 2001 From: ccpro10 Date: Wed, 3 Sep 2025 19:45:24 +0800 Subject: [PATCH] fix: export JSONResponse field --- mcp/streamable.go | 8 ++++---- mcp/streamable_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mcp/streamable.go b/mcp/streamable.go index f56eabd9..f1a8ca12 100644 --- a/mcp/streamable.go +++ b/mcp/streamable.go @@ -72,8 +72,8 @@ type StreamableHTTPOptions struct { // TODO: support session retention (?) - // jsonResponse is forwarded to StreamableServerTransport.jsonResponse. - jsonResponse bool + // JSONResponse is forwarded to StreamableServerTransport.jsonResponse. + JSONResponse bool } // NewStreamableHTTPHandler returns a new [StreamableHTTPHandler]. @@ -233,7 +233,7 @@ func (h *StreamableHTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Reque transport = &StreamableServerTransport{ SessionID: sessionID, Stateless: h.opts.Stateless, - jsonResponse: h.opts.jsonResponse, + jsonResponse: h.opts.JSONResponse, } // To support stateless mode, we initialize the session with a default @@ -487,7 +487,7 @@ type stream struct { // jsonResponse records whether this stream should respond with application/json // instead of text/event-stream. // - // See [StreamableServerTransportOptions.jsonResponse]. + // See [StreamableServerTransportOptions.JSONResponse]. jsonResponse bool // signal is a 1-buffered channel, owned by an incoming HTTP request, that signals diff --git a/mcp/streamable_test.go b/mcp/streamable_test.go index c99ca782..1b80cf05 100644 --- a/mcp/streamable_test.go +++ b/mcp/streamable_test.go @@ -84,7 +84,7 @@ func TestStreamableTransports(t *testing.T) { // Start an httptest.Server with the StreamableHTTPHandler, wrapped in a // cookie-checking middleware. handler := NewStreamableHTTPHandler(func(req *http.Request) *Server { return server }, &StreamableHTTPOptions{ - jsonResponse: useJSON, + JSONResponse: useJSON, }) var (