Hey all -I'm working to build a simple tool that allows one to check a given url and emit simple performance metrics. One feature of this tool is that I should be able to visit a url such as "http://1.2.3.4" and apply a separate Host header to it such as "example.org". This would allow one to examine hosts that are capable of serving a specific URL but not necessarily resolving. This is similar to what one could do with curl via the "-H" flag.However, it appears that requests don't actually allow the Host header to take precedence.An example:**package mainimport "os"import "net/http"func main() {// I wish explicitly setting this Host header would take precedencereq.Header.Set("Host", "www.example.org")req.Write(os.Stdout)}**Example output:GET / HTTP/1.1
Host: 1.2.3.4
User-Agent: Go http package
Before I go further, am I doing this correctly? Is there another way?
Best,
Michael Gorsuch
--
Ah yes. You are correct. I noticed Host earlier, but could've sworn that my experiments were showing that setting Host was actually altering the destination host along with the header. Things seems to be working now, so clearly I was mistaken.