From 2ced99e87936c10d6af3270a3c08ef134427080e Mon Sep 17 00:00:00 2001 From: Derrick Wippler Date: Fri, 27 May 2022 13:35:10 -0500 Subject: [PATCH] Added special case for Host headers --- httphelpers.go | 5 +++++ messages_test.go | 2 ++ 2 files changed, 7 insertions(+) diff --git a/httphelpers.go b/httphelpers.go index 3ff0d112..88121a5c 100644 --- a/httphelpers.go +++ b/httphelpers.go @@ -359,6 +359,11 @@ func (r *httpRequest) curlString(req *http.Request, p payload) string { } } + // Special case for Host + if req.Host != "" { + parts = append(parts, fmt.Sprintf("-H \"Host: %s\"", req.Host)) + } + //parts = append(parts, fmt.Sprintf(" --user '%s:%s'", r.BasicAuthUser, r.BasicAuthPassword)) if p != nil { diff --git a/messages_test.go b/messages_test.go index 112f62f4..131686a0 100644 --- a/messages_test.go +++ b/messages_test.go @@ -582,6 +582,8 @@ func TestAddOverrideHeader(t *testing.T) { ensure.Nil(t, err) ensure.DeepEqual(t, msg, exampleMessage) ensure.DeepEqual(t, id, exampleID) + + ensure.StringContains(t, mg.GetCurlOutput(), "Host:") } func TestCaptureCurlOutput(t *testing.T) {