Follow redirects on server responses #82
Merged
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.
Closes #80
PR implements the
follow-redirects
library into the client, such that if a request to the server returns a 301, it'll be followed, instead of the user getting anexecution error:invalid response code (301)
error. This is principally to handle the case where a request goes to a HTTP endpoint behind a load balancer, and the load balancer responds with a 301 to upgrade the request to HTTPS.follow-redirects
does offer some options (e.g. whether to follow redirects at all, amount of redirects to follow, etc.), but I don't think it's really meaningful to expose them to end users of the client as I think pretty much all consumers are probably going to be fine with the defaults.