New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test if we correctly strip request-body-headers for redirects #20596
Test if we correctly strip request-body-headers for redirects #20596
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This generally looks okay, but I think we should have coverage for all headers to be removed (and maybe also check that other headers are not removed) and also some arbitrary methods, such as TESTING
or some such.
|
||
promise_test(function(test) { | ||
return fetch(url + urlParameters, requestInit).then(function(resp) { | ||
let isPostEnded = (expectedMethod == "POST"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It only ends if it's a 301/302/303, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expectedMethod == "POST"
implies it's not 301/302/303
We couldn't do redirecting from/to |
After talk to @annevk, we still can send TESTING method for fetch() though it's a little bit weird. I don't test GET->GET redirection. Spec doesn't ask for removing header, but it's weird to have request-body-headers as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I'd prefer asserting actual values where possible and I'd also like the Content-Length
test you had before to be reinstated. Even though developers cannot set Content-Length
, it still seems good to test that it's properly reset by browsers during redirects. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I'd prefer asserting actual values where possible and I'd also like the
Content-Length
test you had before to be reinstated. Even though developers cannot setContent-Length
, it still seems good to test that it's properly reset by browsers during redirects. What do you think?
Yeah, let's take Content-Length
into account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, new Content-Length
tests end up catching some bugs in Safari. I'll file bugs against Chrome and Safari.
Issue: whatwg/fetch#609
Spec change: whatwg/fetch#977