Fix SSE content-type error message format
This commit is contained in:
parent
88c6098495
commit
970905c313
2 changed files with 2 additions and 2 deletions
|
|
@ -264,7 +264,7 @@ describe('SSEServerTransport', () => {
|
|||
await transport.handlePostMessage(mockReq, mockHandleRes, { jsonrpc: '2.0', method: 'test' });
|
||||
|
||||
expect(mockHandleRes.writeHead).toHaveBeenCalledWith(400);
|
||||
expect(mockHandleRes.end).toHaveBeenCalledWith('Error: Content-Type must start with application/json, got: text/plain');
|
||||
expect(mockHandleRes.end).toHaveBeenCalledWith('Error: Unsupported content-type: text/plain');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ export class SSEServerTransport implements Transport {
|
|||
try {
|
||||
const ct = contentType.parse(req.headers["content-type"] ?? "");
|
||||
if (ct.type !== "application/json") {
|
||||
throw new Error(`Unsupported content-type: ${ct}`);
|
||||
throw new Error(`Unsupported content-type: ${ct.type}`);
|
||||
}
|
||||
|
||||
body = parsedBody ?? await getRawBody(req, {
|
||||
|
|
|
|||
Loading…
Reference in a new issue