Follow redirects in the client - #22
Merged
Merged
Conversation
The client follows 301, 302, 303, 307 and 308 redirects, up to `request-options.max-redirects`. 0 returns the redirect response, when none the implementation chooses the limit, 10 for this client. A redirect keeps the method and body, except a 303, or a 301 or 302 for POST, which switches to GET without the body, see RFC 9110 section 15.4. Credentials are not sent when a redirect leaves the origin, and headers describing the body are not sent without the body. New error codes: * redirect-limit-exceeded: the redirect response past the limit, and the number of redirects followed * redirect-requires-body: a redirect that sends the body again. The body was streamed, the client can't send it again. Contains the redirect response, and the method, url, headers and options to send it again with the body. The options have `max-redirects` set to the redirects remaining. Trailers have their own trailers-error-code, error-code contains an http-response, whose trailers can't refer back to error-code. Signed-off-by: Scott Andrews <scott@andrews.me> Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The client follows 301, 302, 303, 307 and 308 redirects, up to
request-options.max-redirects. 0 returns the redirect response, when none the implementation chooses the limit, 10 for this client.A redirect keeps the method and body, except a 303, or a 301 or 302 for POST, which switches to GET without the body, see RFC 9110 section 15.4. Credentials are not sent when a redirect leaves the origin, and headers describing the body are not sent without the body.
New error codes:
max-redirectsset to the redirects remaining.Trailers have their own trailers-error-code, error-code contains an http-response, whose trailers can't refer back to error-code.