RFC 2616 states that for 301 redirects:

"Unless the request method was HEAD, the entity of the response SHOULD
contain a short hypertext note with a hyperlink to the new URI(s)."

https://tools.ietf.org/html/rfc2616#section-10.3.2

I noticed that Go's net/http library's Redirect function only adds the note
for GET Requests. According to the above, shouldn't this
https://golang.org/src/net/http/server.go?s=#L1825 be `if r.Method !=
"HEAD" {`? Also, the RFC does not prohibit the note for POST requests but
the comment on the above code seems to imply so.

Then I noticed that in RFC 7231 it states that for 301 redirects:

"The server's response payload usually contains a short hypertext note with
a hyperlink to the new URI(s)."

https://tools.ietf.org/html/rfc7231#section-6.4.2

Now since this does not specify the methods, I'm not sure whether Go's
behaviour is correct. So my question is, why does Go's http.Redirect
function only add the note for GET Requests?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to