Skip to content

Commit

Permalink
Make sure formatResponse returning null doesn't affect the respon…
Browse files Browse the repository at this point in the history
…se sent
  • Loading branch information
martijnwalraven committed Mar 22, 2019
1 parent 992ab75 commit 4e34508
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/apollo-server-core/src/requestPipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,18 @@ export async function processGraphQLRequest<TContext>(
}

if (config.formatResponse) {
response = config.formatResponse(response, {
context: requestContext.context,
});
const formattedResponse: GraphQLResponse | null = config.formatResponse(
response,
{
context: requestContext.context,
},
);
if (formattedResponse != null) {
response = formattedResponse;
}
}

return sendResponse(response!!);
return sendResponse(response);
} finally {
requestDidEnd();
}
Expand Down

0 comments on commit 4e34508

Please sign in to comment.