You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the current client follows a redirect, all subsequent requests are sent without any
of the headers sent on the initial request. The following program demonstrates this
behaviour:
http://play.golang.org/p/AExnEZNwv8
The header which gets printed on stdout is empty; I'd expect it to be equal to
"bytes=0-1", the value set in the original request.
This is counterintuitive and makes the Request.Header useless if a redirect can occur.
It seems that one must either make a custom transport wrapper that adds headers and
create a client on top of that, or use an undocumented feature of CheckRedirect, namely
that the request passed is going to be actually sent, so it can modify it before that.
I'm not sure what resolution I'd expect. My main problem is that this behaviour confused
me, and I can't see an elegant way of setting eg. a Range header on subsequent requests
-- creating a new transport wrapper for every request seems weird, even if it's mostly
cost-free.
The text was updated successfully, but these errors were encountered:
by robryk:
The text was updated successfully, but these errors were encountered: