New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set response on the context #40
Conversation
…e identical behavior as appollo-link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 🙂
I'll look into merging this as soon as I can; it's a busy end to the week.
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "apollo-upload-client", | |||
"version": "6.0.2", | |||
"version": "6.0.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best to undo this; I'll update the changelog and version in a few places myself prior to a release.
src/index.mjs
Outdated
@@ -66,6 +74,7 @@ export const createUploadLink = ( | |||
.then(response => { | |||
if (!response.ok) | |||
throw new Error(`${response.status} (${response.statusText})`) | |||
operation.setContext({ response }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should come before the response check above. Otherwise if the response is not ok, the response will not be attached to the context like in apollo-link-http
.
In apollo-link the raw-response is available in the context in order to e.g. access the response headers in a afterware.
Ive attached the response here too.
https://github.com/apollographql/apollo-link/blob/685b07dd024b2e97a0929ac841ba5e1d19aa042a/packages/apollo-link-http/src/httpLink.ts#L179