Relative redirect is not followed correctly
ioquatix opened this issue · 5 comments
ioquatix commented
According to https://tools.ietf.org/html/rfc7231#section-7.1.2 a relative location can be returned in the location header.
However, if the request for, say /foo/bar
returns Location: baz
, rack-test
follow_redirects!
generates a request for /baz
, not /foo/baz
like it probably should (and as supported by the RFC.
perlun commented
However, if the request for, say /foo/bar returns Location: baz, rack-test follow_redirects! generates a request for /baz, not /foo/baz like it probably should (and as supported by the RFC.
Thanks for letting us know! Would you be willing to submit a PR that fixes this incorrect behavior?
ioquatix commented
We can use Ruby’s stdlib URI parser
ioquatix commented
Okay I've made a PR.
ioquatix commented
Thanks :)
perlun commented
NP!