-
Notifications
You must be signed in to change notification settings - Fork 1.7k
http: on redirect, headers are copied to new request #45410
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
Comments
Thanks for the report. |
In my case, it's a GET request. The first http server checks my It works fine with
|
Aha, thanks for the details. It looks like Meanwhile, Dart developers have a control over whether redirects are automatically followed via https://api.flutter.dev/flutter/dart-io/HttpClientRequest/followRedirects.html, if redirects are followed manually developer can strip out headers as needed. |
Alright, the special case for 'Authorization' explains it. |
Hi, I'd like to follow up on this as well. I seems to have run into the same(?) issue, but with a 307. Can you confirm whether or not this seems to be the case? I'm making a GET request to an endpoint that requires Authentication header to be set. The uri I'm getting redirected to does not require an authentication header to be set and is on a new hostname. I have been able to figure out that the issue seems to have to do with that. There is a setting in Postman (that is found under the Settings tab) that is disabled by default:
When I enable that feature in Postman, I get the same problem as I do with HttpClient when running |
TESTED=updated unit tests Bug: #45410 Change-Id: I7c555a4818fd719d42748b6a18780e3d9b3ee147 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229947 Reviewed-by: Alexander Aprelev <[email protected]> Commit-Queue: Brian Quinlan <[email protected]>
#47246 also seems to be a duplicate of this? |
Fixed in 57db739 |
TESTED=updated unit tests Bug: #45410 Change-Id: I7c555a4818fd719d42748b6a18780e3d9b3ee147 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229947 Reviewed-by: Alexander Aprelev <[email protected]> Commit-Queue: Brian Quinlan <[email protected]>
On a HTTP 302 redirect, the headers of the original request are copied over to the new request.
AFAIK, copying headers in this case is wrong.
https://github.com/dart-lang/sdk/blob/master/sdk/lib/_http/http_impl.dart#L2493-L2498
This is causing problems in my application. My url works well with
curl -L
but does not withdart http
.The text was updated successfully, but these errors were encountered: