Closed
Description
by mdriley:
307 means "try the same verb on this new URL". Client allows callers to define a redirect policy (CheckRedirect) for whether a given HTTP redirect should or shouldn't be followed. However, Client.Do() passes an additional policy to doFollowingRedirects() for GET, HEAD, PUT, and POST that is called before CheckRedirect. For PUT and POST, that policy only redirects on 302 and 303. Further, doFollowingRedirects() explicitly changes the verb from POST or PUT to GET on redirect. As a result, the API provides no way for callers to follow a 307 redirect and keep the verb. I imagine the code was written not to follow these redirects because the spec for this case says "the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user". The API should allow the CheckRedirect policy to say such redirects are okay. wget and curl both support these redirects.