Closed
Description
Commit 7db996e alters the behavior of redirects with the HEAD
method unnecessarily.
The logic in Go1.7 had the following properties:
- It automatically handled redirects for
GET
,HEAD
,PUT
,POST
methods only. - However, in the situations where the method was
PUT
orPOST
, it would convert it to be theGET
method. - Thus, all methods were redirected as
GET
exceptHEAD
, which continued to be redirected asHEAD
.
The logic in Go1.8 has the following properties:
- For 301, 302, and 303 redirects, the redirect method would always be set to
GET
.
For backwards compatibility reasons, we should keep redirecting HEAD
as HEAD
. There is no harm in preserving this old behavior since the RFC doesn't specify that methods must be set to GET
for 301, 302, and 303 redirect.
Reproducer: https://play.golang.org/p/kKuGNRjHV9