Skip to content

Commit

Permalink
Merge pull request #40 from Knaackee/master
Browse files Browse the repository at this point in the history
Set the raw response on the context.
  • Loading branch information
jaydenseric committed Nov 19, 2017
2 parents 8e93a5f + 742bb12 commit 5942df8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const createUploadLink = (
} = {}
) =>
new ApolloLink(
({ operationName, variables, query, extensions, getContext }) =>
({ operationName, variables, query, extensions, getContext, setContext }) =>
new Observable(observer => {
const requestOperation = {
operationName,
Expand Down Expand Up @@ -64,6 +64,7 @@ export const createUploadLink = (

linkFetch(uri, fetchOptions)
.then(response => {
setContext({ response })
if (!response.ok)
throw new Error(`${response.status} (${response.statusText})`)
return response.json()
Expand Down

0 comments on commit 5942df8

Please sign in to comment.