Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm working to get the
{ redirect: 'manual' }
option working in my codebase, so that I can detect when a middleman is redirecting my requests to my API server and respond accordingly.Currently, I'm finding that when I include this option and make a request that redirects, I get a
SyntaxError
thrown as a result. This is coming fromr.json()
since the browser returns a response object withtype: 'opaqueredirect'
which isn't a JSON string.My proposed solution is to catch errors from the JSON conversion and throw the original response object as an error in that case, which works for my use case. I'm also open to other ways of making this original response object accessible to the caller, though.
I had trouble getting the integration tests to run, so that I could extend them and implement a test case for this. Trying to run
./scripts/gen-server-proto.sh
after making a change to the server to add an endpoint that redirects, I get: