Skip to content

Commit

Permalink
fix!: Capitalize "Authorization" header name (#252)
Browse files Browse the repository at this point in the history
HTTP headers are case insensitive,
however "Authorization" is a standard header name.

Relevant documentation:
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization
- https://tools.ietf.org/html/rfc7235#section-4.2

Co-authored-by: Guillaume Chau <[email protected]>
  • Loading branch information
franciscolourenco and Akryum authored Jun 8, 2020
1 parent d6aa49e commit cefe9dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions graphql-client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export function createApolloClient ({

// HTTP Auth header injection
authLink = setContext(async (_, { headers }) => {
const authorization = await getAuth(tokenName)
const authorizationHeader = authorization ? { authorization } : {}
const Authorization = await getAuth(tokenName)
const authorizationHeader = Authorization ? { Authorization } : {}
return {
headers: {
...headers,
Expand Down Expand Up @@ -122,8 +122,8 @@ export function createApolloClient ({
wsClient = new SubscriptionClient(wsEndpoint, {
reconnect: true,
connectionParams: () => {
const authorization = getAuth(tokenName)
return authorization ? { authorization, headers: { authorization } } : {}
const Authorization = getAuth(tokenName)
return Authorization ? { Authorization, headers: { Authorization } } : {}
},
})

Expand Down

0 comments on commit cefe9dd

Please sign in to comment.