-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Conversation
✅ Deploy Preview for apollo-server-docs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 9cd9f38:
|
Thanks for the PR! Would you please add a changeset by running |
This PR was opened by the [Changesets release](/~https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @apollo/server-integration-testsuite@4.3.1 ### Patch Changes - [#7285](#7285) [`35fa72bdd`](35fa72b) Thanks [@glasser](/~https://github.com/glasser)! - Adds an integration test verifying that Rover's introspection query works. This should not break any integration that passes other tests. - [#7276](#7276) [`15c912f4c`](15c912f) Thanks [@renovate](/~https://github.com/apps/renovate)! - Update graphql-http dependency - Updated dependencies \[[`ec28b4b33`](ec28b4b), [`322b5ebbc`](322b5eb), [`3b0ec8529`](3b0ec85)]: - @apollo/server@4.3.1 ## @apollo/server@4.3.1 ### Patch Changes - [#7313](#7313) [`ec28b4b33`](ec28b4b) Thanks [@vtipparam](/~https://github.com/vtipparam)! - Allow case insensitive lookup on headers. Use HeaderMap instead of plain Map for headers in expressMiddleware. - [#7311](#7311) [`322b5ebbc`](322b5eb) Thanks [@axe-me](/~https://github.com/axe-me)! - Export intermediate ApolloServerOptions\* types - [#7274](#7274) [`3b0ec8529`](3b0ec85) Thanks [@patrick91](/~https://github.com/patrick91)! - The subgraph spec has evolved in Federation v2 such that the type of `_Service.sdl` (formerly nullable) is now non-nullable. Apollo Server now detects both cases correctly in order to determine whether to: 1. install / enable the `ApolloServerPluginInlineTrace` plugin 2. throw on startup if `ApolloServerPluginSchemaReporting` should not be installed 3. warn when `ApolloServerPluginUsageReporting` is installed and configured with the `__onlyIfSchemaIsNotSubgraph` option Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Huh! @trevor-scheer do you understand why this wasn't a compilation failure? The field |
Yeah I suppose so: https://www.typescriptlang.org/docs/handbook/2/classes.html#relationships-between-classes Do we want to make some change here (somehow compatibly?) to make this issue less possible? |
I was wondering about that as well. Magic of Duck Typing in Typescript? |
Yeah, maybe some additional property on the HeaderMap will give us the differentiation we're expectingto have. |
Related: #7313 This shouldn't have been allowed by the typings in the first place. Previously, a `Map` was compatible with `HeaderMap` according to TypeScript, so the error wasn't a typing error (when we wanted it to be). Adding an arbitrary class property to the `HeaderMap` class gives us the typing error we'd expect when a `Map` is used in lieu of a `HeaderMap`.
FYI, any of the apollo-server-integrations until each one has switched over to use HeaderMap AND cuts a new release, consumers will likely still be using case-sensitve map for headers.
|
Hey @theJC. These integrations are intentionally (somewhat) disparate and community-owned, so while at some level I help maintain them in a pinch / as-needed, the hope is that community members who are interested in both Apollo Server and their respective framework of choice maintain them, respond to issues, etc. It's not a perfect system but I do keep an eye on them and step in if needed. That being said - we do export an integration testsuite and typings which act as a guide for integration authors to stay in step with expected behaviors. As long as authors keep their dev dependencies up-to-date, use TypeScript, and run our testsuite in CI, we can reasonably expect things should be working as intended. In the specific The important part for this to work is that we remain vigilant with appropriate testsuite additions and typings fixes as applicable. This is imperfect, but it's pretty good. And to be fair to this project, AS4 has successfully made these integrations very simple and the pattern repeatable so overall I'm not too worried about this being a recurring or frequent problem. If you see any places where we can improve this process or have anything in mind, I'd be happy to hear ideas! And if you'd like to participate / help improve any of the integrations you're of course invited to do so. |
The
expressMiddleware
handler uses a plainMap
for the headers that results in case sensitive lookup on the headers. This makes the headerApollo-Query-Plan-Experimental
ineffective when the ApolloServer is used withexpressMiddleware
handler.Resolves apollographql/federation#2337