Opened 9 months ago

Last modified 4 days ago

#27999 assigned New feature

Add test Client support for HTTP 307 and 308 redirects

Reported by: anentropic Owned by: Tom Forbes
Component: Testing framework Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In the TestClient... 308 status is not recognised at all currently.

307 is just treated the same as the other redirects (301, 302, 303) and is converted to a GET request, regardless of the original request method.

This is incorrect according to the RFCs... 307 and 308 redirects are supposed to preserve the original method and request body, so a POST request resulting in 307 response should cause the client to re-POST the body to the new Location.

https://tools.ietf.org/html/rfc7231#section-6.4.7
https://tools.ietf.org/html/rfc7538#page-3

I'm happy to prepare a PR for this if it's agreed this should be changed.

Change History (6)

comment:1 Changed 9 months ago by Claude Paroz

Component: UncategorizedTesting framework
Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature
Version: 1.10master

comment:2 Changed 9 months ago by Tim Graham

Summary: TestClient does not correctly handle 307 and 308 redirectsAdd test Client support for HTTP 307 and 308 redirects

comment:3 Changed 7 months ago by Tom Forbes

Owner: changed from nobody to Tom Forbes
Status: newassigned

comment:4 Changed 7 months ago by Tom Forbes

Has patch: set

comment:5 Changed 5 days ago by Tim Martin

Patch needs improvement: set

comment:6 Changed 4 days ago by Tom Forbes

Patch needs improvement: unset

Not sure if I'm meant to remove this flag myself after I've made the changes the reviewer requested, please let me know if not.

Note: See TracTickets for help on using tickets.
Back to Top