Http redirect content-type

I notice that in the http.Redirect function, if the method of the originating request was a GET or a HEAD, then the Content-Type is set to text/html. What is the rationale for this? What is the purpose of setting a Content-Type on a redirect, and what if the page being redirected to, is not of type text/html?

Is this logic right?



Just realised that golang sends an html body in the redirect response, containing an anchor element pointing to the redirect location!

What is not clear to me is why the body terminates the anchor with a ‘.’, any idea?

<a href="">OK</a>.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.