Skip to content

Commit e291f72

Browse files
hdu-sdlzxLiu Zixian
authored andcommitted
Handle 204 No Content status in response processing
Fixes #1303
1 parent 2b20ca9 commit e291f72

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/client/streamableHttp.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,11 @@ export class StreamableHTTPClientTransport implements Transport {
555555
this._hasCompletedAuthFlow = false;
556556
this._lastUpscopingHeader = undefined;
557557

558-
// If the response is 202 Accepted, there's no body to process
559-
if (response.status === 202) {
560-
await response.body?.cancel();
558+
// If the response is 202 Accepted or 204 No Content, there's no body to process
559+
if (response.status === 202 || response.status === 204) {
560+
if (response.status === 202) {
561+
await response.body?.cancel();
562+
}
561563
// if the accepted notification is initialized, we start the SSE stream
562564
// if it's supported by the server
563565
if (isInitializedNotification(message)) {

0 commit comments

Comments
 (0)