Skip to content

Commit 65df1b0

Browse files
authored
fix(streamble_http) SendNotification not work bug (#473)
1 parent 2d479bb commit 65df1b0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

server/streamable_http.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ func (s *StreamableHTTPServer) handlePost(w http.ResponseWriter, r *http.Request
293293
w.Header().Set("Content-Type", "text/event-stream")
294294
w.Header().Set("Connection", "keep-alive")
295295
w.Header().Set("Cache-Control", "no-cache")
296-
w.WriteHeader(http.StatusAccepted)
296+
w.WriteHeader(http.StatusOK)
297297
upgradedHeader = true
298298
}
299299
err := writeSSEEvent(w, nt)
@@ -332,7 +332,7 @@ func (s *StreamableHTTPServer) handlePost(w http.ResponseWriter, r *http.Request
332332
w.Header().Set("Content-Type", "text/event-stream")
333333
w.Header().Set("Connection", "keep-alive")
334334
w.Header().Set("Cache-Control", "no-cache")
335-
w.WriteHeader(http.StatusAccepted)
335+
w.WriteHeader(http.StatusOK)
336336
upgradedHeader = true
337337
}
338338
if err := writeSSEEvent(w, response); err != nil {

server/streamable_http_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ func TestStreamableHTTP_POST_SendAndReceive(t *testing.T) {
283283
}
284284
defer resp.Body.Close()
285285

286-
if resp.StatusCode != http.StatusAccepted {
287-
t.Errorf("Expected status 202, got %d", resp.StatusCode)
286+
if resp.StatusCode != http.StatusOK {
287+
t.Errorf("Expected status 200, got %d", resp.StatusCode)
288288
}
289289
if resp.Header.Get("content-type") != "text/event-stream" {
290290
t.Errorf("Expected content-type text/event-stream, got %s", resp.Header.Get("content-type"))

0 commit comments

Comments
 (0)