Skip to content

Commit 6e75141

Browse files
authored
fix: also set rawHeaders to the fake incoming message (#132)
* fix: also set rawHeaders to the fake incoming message * fix: proper handling of multiple values * release: add patch changeset
1 parent aa280be commit 6e75141

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

.changeset/puny-meals-sniff.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"mcp-handler": patch
3+
---
4+
5+
Add raw headers to incoming message

src/handler/mcp-api-handler.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,11 @@ function createFakeIncomingMessage(
870870
req.method = method;
871871
req.url = url;
872872
req.headers = headers;
873+
req.rawHeaders = Object.entries(headers).flatMap(([key, value]) =>
874+
Array.isArray(value)
875+
? value.flatMap(v => [key, v])
876+
: [key, value ?? ""]
877+
);
873878

874879
const auth = options.auth || getAuthContext();
875880
if (auth) {

0 commit comments

Comments
 (0)