We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 925a732 commit 3306caeCopy full SHA for 3306cae
src/handler.ts
@@ -390,9 +390,9 @@ export function createHandler<RawRequest = unknown>(
390
let document: DocumentNode;
391
try {
392
document = parse(query);
393
- } catch {
+ } catch (err) {
394
return [
395
- 'GraphQL query syntax error',
+ JSON.stringify({ errors: [err] }),
396
{
397
...(acceptedMediaType === 'application/json'
398
? {
@@ -404,6 +404,12 @@ export function createHandler<RawRequest = unknown>(
404
statusText: 'Bad Request',
405
}),
406
407
+ headers: {
408
+ 'content-type':
409
+ acceptedMediaType === 'application/json'
410
+ ? 'application/json; charset=utf-8'
411
+ : 'application/graphql+json; charset=utf-8',
412
+ },
413
},
414
];
415
}
0 commit comments