Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use HeaderMap instead of plain Map for headers #7313

Merged
merged 2 commits into from Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/blue-planets-juggle.md
@@ -0,0 +1,5 @@
---
'@apollo/server': patch
---

Allow case insensitive lookup on headers. Use HeaderMap instead of plain Map for headers in expressMiddleware.
3 changes: 2 additions & 1 deletion packages/server/src/express4/index.ts
Expand Up @@ -7,6 +7,7 @@ import type {
HTTPGraphQLRequest,
} from '../externalTypes/index.js';
import { parse as urlParse } from 'url';
import { HeaderMap } from '../utils/HeaderMap.js';

export interface ExpressContextFunctionArgument {
req: express.Request;
Expand Down Expand Up @@ -56,7 +57,7 @@ export function expressMiddleware<TContext extends BaseContext>(
return;
}

const headers = new Map<string, string>();
const headers = new HeaderMap();
for (const [key, value] of Object.entries(req.headers)) {
if (value !== undefined) {
// Node/Express headers can be an array or a single value. We join
Expand Down