• Eivind Uggedal's avatar
    http: make HEAD client request follow redirects · 092f34fe
    Eivind Uggedal authored
    HEAD requests should in my opinion have the ability to follow redirects
    like the implementation of GET requests does. My use case is polling
    several thousand severs to check if they respond with 200 status codes.
    Using GET requests is neither efficient in running time of the task nor
    for bandwidth consumption.
    
    This suggested patch changes the return signature of http.Head() to match
    that of http.Get(), providing the final URL in a redirect chain.
    
    `curl -IL http://google.com` follows redirects with HEAD requests just fine.
    
    Fixes #1806.
    
    R=golang-dev, bradfitz, rsc
    CC=golang-dev
    https://golang.org/cl/4517058
    092f34fe
client_test.go 3.5 KB