Skip to content

Commit

Permalink
Add check for Query document. Credits to @Aides359 from apollographql#31
Browse files Browse the repository at this point in the history


Credits to @Aides359 from apollographql#31
  • Loading branch information
clemens-tolboom authored May 27, 2018
1 parent 94b7ab6 commit 5e6c79e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/network_interface/ApolloNetworkInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ export function addPersistedQueries(networkInterface: NetworkInterface, queryMap
return Object.assign(networkInterface, {
query: (request: Request): Promise<ExecutionResult> => {
const queryDocument = request.query;

if (queryDocument === undefined) {
return Promise.reject(new Error('No query document was provided'));
}

const queryKey = getQueryDocumentKey(queryDocument);

if (!queryMap[queryKey]) {
Expand Down

0 comments on commit 5e6c79e

Please sign in to comment.