Skip to content

Commit 970905c

Browse files
committed
Fix SSE content-type error message format
1 parent 88c6098 commit 970905c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/server/sse.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ describe('SSEServerTransport', () => {
264264
await transport.handlePostMessage(mockReq, mockHandleRes, { jsonrpc: '2.0', method: 'test' });
265265

266266
expect(mockHandleRes.writeHead).toHaveBeenCalledWith(400);
267-
expect(mockHandleRes.end).toHaveBeenCalledWith('Error: Content-Type must start with application/json, got: text/plain');
267+
expect(mockHandleRes.end).toHaveBeenCalledWith('Error: Unsupported content-type: text/plain');
268268
});
269269
});
270270

src/server/sse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export class SSEServerTransport implements Transport {
155155
try {
156156
const ct = contentType.parse(req.headers["content-type"] ?? "");
157157
if (ct.type !== "application/json") {
158-
throw new Error(`Unsupported content-type: ${ct}`);
158+
throw new Error(`Unsupported content-type: ${ct.type}`);
159159
}
160160

161161
body = parsedBody ?? await getRawBody(req, {

0 commit comments

Comments
 (0)