From c4f8680ec0fff334f24b4841559162507eff33c5 Mon Sep 17 00:00:00 2001 From: James Baxley Date: Tue, 1 May 2018 20:05:36 -0700 Subject: [PATCH] fix header setting and error message for introspection --- .../apollo-server-cloudflare/src/cloudflareApollo.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/apollo-server-cloudflare/src/cloudflareApollo.ts b/packages/apollo-server-cloudflare/src/cloudflareApollo.ts index 89c94c1f56a..c5675707b1e 100644 --- a/packages/apollo-server-cloudflare/src/cloudflareApollo.ts +++ b/packages/apollo-server-cloudflare/src/cloudflareApollo.ts @@ -39,11 +39,18 @@ export function graphqlCloudflare(options: GraphQLOptions) { options: options, query, }).then( - gqlResponse => new Response(JSON.stringify(gqlResponse)), + gqlResponse => + new Response(gqlResponse, { + status: 200, + headers: { 'content-type': 'application/json' }, + }), (error: HttpQueryError) => { if ('HttpQueryError' !== error.name) throw error; - const res = new Response(error.message, { status: error.statusCode }); + const res = new Response(error.message, { + status: error.statusCode, + headers: { 'content-type': 'application/json' }, + }); if (error.headers) { Object.keys(error.headers).forEach(header => {