Skip to content

Commit

Permalink
fix header setting and error message for introspection
Browse files Browse the repository at this point in the history
  • Loading branch information
James Baxley authored and evans committed May 3, 2018
1 parent 17ed7aa commit c4f8680
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/apollo-server-cloudflare/src/cloudflareApollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit c4f8680

Please sign in to comment.