apollo-link-rest icon indicating copy to clipboard operation
apollo-link-rest copied to clipboard

Support for server response code 307

Open nickverstocken opened this issue 7 years ago • 3 comments

I try to do a query which returns a temporary download link with status code 307, I can get a response from the network but Right now the everything that has a response code of >= 300 is handled as an error in the restLink.ts file...

Error : Error: Network error: Response not successful: Received status code 307

Is there any workaround for this issue or can it be solved?

Thanks!

nickverstocken avatar Aug 23 '18 12:08 nickverstocken

I’m no expert at HTTP, I’d be happy for a feature thange that has more nuance there or makes an exception for 307 and other codes?

fbartho avatar Aug 26 '18 17:08 fbartho

Awesome! I think you can make an exception for all the 3xx status codes. Because this always indicates a redirect of some sort which the client should handle or a location header would be present on the request...

nickverstocken avatar Aug 27 '18 10:08 nickverstocken

@nickverstocken -- 302 and some other 3xx-class codes are automatically (transparently) handled in many cases. You have to opt out to avoid 302 redirects. I guess I'm wondering why 307 isn't transparently handled in this case?

Happy for a PR change that documents how we're supposed to handle that class of status codes!

fbartho avatar Sep 16 '18 23:09 fbartho