Fix `Host` header not being sent

See: https://github.com/golang/go/issues/7682

Custom headers are set using `headers.Set(..)`.
When it comes to the `Host` header however, this will have no impact
because the request uses the `Host` field from `Request`. If it is
not set, then `URL.Host` will be used.

This commit will make `wuzz` behaviour consistent with cURL.
pull/93/head
Ian Lai 7 years ago
parent 07ede4e6f1
commit 164c4ed19d

@ -819,6 +819,11 @@ func (a *App) SubmitRequest(g *gocui.Gui, _ *gocui.View) error {
}
req.Header = headers
// set the `Host` header
if headers.Get("Host") != "" {
req.Host = headers.Get("Host")
}
// do request
start := time.Now()
response, err := CLIENT.Do(req)

Loading…
Cancel
Save