fix(server): application/json header for notifictions (#1373)
This commit is contained in:
parent
09a658b1c3
commit
8b6e455c79
3 changed files with 12 additions and 1 deletions
5
.changeset/strong-hairs-study.md
Normal file
5
.changeset/strong-hairs-study.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@modelcontextprotocol/server': patch
|
||||
---
|
||||
|
||||
add application/json header for notifications
|
||||
|
|
@ -667,7 +667,12 @@ export class WebStandardStreamableHTTPServerTransport implements Transport {
|
|||
for (const message of messages) {
|
||||
this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo });
|
||||
}
|
||||
return new Response(null, { status: 202 });
|
||||
return new Response(null, {
|
||||
status: 202,
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// The default behavior is to use SSE streaming
|
||||
|
|
|
|||
|
|
@ -651,6 +651,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
|
|||
const response = await sendPostRequest(baseUrl, batchNotifications, sessionId);
|
||||
|
||||
expect(response.status).toBe(202);
|
||||
expect(response.headers.get('content-type')).toBe('application/json');
|
||||
});
|
||||
|
||||
it('should handle batch request messages with SSE stream for responses', async () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue