Skip to content
Snippets Groups Projects
Commit 24d581dc authored by Daniel Bimschas's avatar Daniel Bimschas
Browse files

Merge branch 'NOISSUE-language-fallback' into 'main'

NOISSUE: use request header as fallback for locale

See merge request app/holi-geo-api!33
parents 5e9f5d1c 682c4173
No related branches found
No related tags found
No related merge requests found
......@@ -96,6 +96,11 @@ export type GraphQLContext = {
}
}
}
request?: {
headers?: {
[key: string]: string
}
}
language?: string
}
......@@ -121,7 +126,7 @@ export const createGraphQLServer = (config: ServerConfig): GraphQLServer => {
graphiql: true,
plugins,
context: (context: GraphQLContext) => {
const headers = new Headers(context.params?.extensions?.headers)
const headers = new Headers(context.params?.extensions?.headers ?? context.request?.headers)
const languages = headers.get('accept-language') || DEFAULT_LANGUAGE
return {
...context,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment