diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2021-02-19 17:03:09 +0000 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2021-02-19 17:03:09 +0000 |
| commit | 0430d12e263d63134d3877ab270b222de9a47b15 (patch) | |
| tree | d27031d0648cce5a35e391e8b36ef03d5bb00a4f | |
| parent | 22080b433641f8eb88c24d0a514febbfde7d5454 (diff) | |
Fix broken tests
| -rw-r--r-- | cmd/fwdsms/twilio_test.go | 6 |
1 files changed, 4 insertions, 2 deletions
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: |
