From 7c23e647c490e56d5deddae3d465d9ea10f57f2e Mon Sep 17 00:00:00 2001 From: Jesse Rosenberger Date: Tue, 17 Apr 2018 19:34:51 +0300 Subject: [PATCH] Maintain use of `context.done()`, but use `isRaw` instead. Per the Azure documentation regarding the response object available at: https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node#response-object --- .../src/azureFunctionsApollo.ts | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/packages/apollo-server-azure-functions/src/azureFunctionsApollo.ts b/packages/apollo-server-azure-functions/src/azureFunctionsApollo.ts index e03f92495ec..aa20e7c8609 100755 --- a/packages/apollo-server-azure-functions/src/azureFunctionsApollo.ts +++ b/packages/apollo-server-azure-functions/src/azureFunctionsApollo.ts @@ -63,8 +63,16 @@ export function graphqlAzureFunctions( return runHttpQuery([httpContext, request], queryRequest) .then(gqlResponse => { - httpContext.res.setHeader('Content-Type', 'application/json'); - httpContext.res.raw(gqlResponse); + const result = { + status: HttpStatusCodes.OK, + headers: { + 'Content-Type': 'application/json', + }, + body: gqlResponse, + isRaw: true, + }; + httpContext.res = result; + httpContext.done(null, result); }) .catch(error => { const result = { @@ -98,8 +106,16 @@ export function graphiqlAzureFunctions( resolveGraphiQLString(query, options, httpContext, request).then( graphiqlString => { - httpContext.res.setHeader('Content-Type', 'text/html; charset-utf-8'); - httpContext.res.raw(graphiqlString); + const result = { + status: HttpStatusCodes.OK, + headers: { + 'Content-Type': 'text/html', + }, + body: graphiqlString, + isRaw: true, + }; + httpContext.res = result; + httpContext.done(null, result); }, error => { httpContext.res = {