From 0430d12e263d63134d3877ab270b222de9a47b15 Mon Sep 17 00:00:00 2001 From: GrĂ©goire DuchĂȘne Date: Fri, 19 Feb 2021 17:03:09 +0000 Subject: Fix broken tests --- cmd/fwdsms/twilio_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/fwdsms/twilio_test.go b/cmd/fwdsms/twilio_test.go index 38a34b4..6418965 100644 --- a/cmd/fwdsms/twilio_test.go +++ b/cmd/fwdsms/twilio_test.go @@ -44,14 +44,16 @@ func TestSMSHandler_checkRequestSignature_SignatureMismatch(t *testing.T) { req.Header.Set("Content-Type", "application/x-www-form-urlencoded") req.Header.Set("X-Twilio-Signature", "DYIRnXpKIjrgAMxc0FD01B55+ag=") assert.NoError(t, req.ParseForm()) - assert.EqualError(t, handler.checkRequestSignature(req), "request signature mismatch") + assert.EqualError(t, handler.checkRequestSignature(req), "signature mismatch") } func TestSMSHandler_checkRequestSignature_SignatureGood(t *testing.T) { form := url.Values{} form.Set("foo", "bar") form.Set("bar", "baz") - req, err := http.NewRequest(http.MethodPost, "https://example.com/endpoint", strings.NewReader(form.Encode())) + req, err := http.NewRequest(http.MethodPost, "/endpoint", strings.NewReader(form.Encode())) + req.Host = "example.com" + req.URL.Scheme = "https" assert.NoError(t, err) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") // Signature generated with: -- cgit v1.2.3-70-g09d2