Closed
Description
by mislav.marohnic:
go version: go1.2 The `Header.Add` line in the following code doesn't have any effect: client := &http.Client {} req, _ := http.NewRequest("GET", "http://127.0.0.1:9292";, nil) req.Header.Add("Host", "example.com") client.Do(req) I expected that the server on 127.0.0.1:9292 receives a request with the header "Host: example.com", but the request was made with "Host: 127.0.0.1:9292" instead. This does the trick, however: req.Host = "example.com" I was wondering why doesn't the first approach work? Relevant code: https://code.google.com/p/go/source/browse/src/pkg/net/http/request.go?name=go1.2#301