Skip to content

Follow redirects in the client - #22

Merged
scothis merged 1 commit into
componentized:mainfrom
scothis:follow-redirects
Oct 3, 2026
Merged

scothis merged 1 commit into
componentized:mainfrom
scothis:follow-redirects

Conversation

@scothis

@scothis scothis commented Oct 3, 2026

Copy link
Copy Markdown
Member

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.

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>
@scothis
scothis merged commit 900e4ca into componentized:main Oct 3, 2026
3 checks passed
@scothis
scothis deleted the follow-redirects branch October 3, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant