aboutsummaryrefslogtreecommitdiffstats
path: root/services/webhook/deliver_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/webhook/deliver_test.go')
-rw-r--r--services/webhook/deliver_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/services/webhook/deliver_test.go b/services/webhook/deliver_test.go
index 6a74b1455c..1d32d7b772 100644
--- a/services/webhook/deliver_test.go
+++ b/services/webhook/deliver_test.go
@@ -64,7 +64,7 @@ func TestWebhookProxy(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.req, func(t *testing.T) {
- req, err := http.NewRequest("POST", tt.req, nil)
+ req, err := http.NewRequest(http.MethodPost, tt.req, nil)
require.NoError(t, err)
u, err := webhookProxy(allowedHostMatcher)(req)
@@ -91,7 +91,7 @@ func TestWebhookDeliverAuthorizationHeader(t *testing.T) {
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, "/webhook", r.URL.Path)
assert.Equal(t, "Bearer s3cr3t-t0ken", r.Header.Get("Authorization"))
- w.WriteHeader(200)
+ w.WriteHeader(http.StatusOK)
done <- struct{}{}
}))
t.Cleanup(s.Close)
@@ -138,7 +138,7 @@ func TestWebhookDeliverHookTask(t *testing.T) {
case "/webhook/66d222a5d6349e1311f551e50722d837e30fce98":
// Version 1
assert.Equal(t, "push", r.Header.Get("X-GitHub-Event"))
- assert.Equal(t, "", r.Header.Get("Content-Type"))
+ assert.Empty(t, r.Header.Get("Content-Type"))
body, err := io.ReadAll(r.Body)
assert.NoError(t, err)
assert.Equal(t, `{"data": 42}`, string(body))
@@ -152,11 +152,11 @@ func TestWebhookDeliverHookTask(t *testing.T) {
assert.Len(t, body, 2147)
default:
- w.WriteHeader(404)
+ w.WriteHeader(http.StatusNotFound)
t.Fatalf("unexpected url path %s", r.URL.Path)
return
}
- w.WriteHeader(200)
+ w.WriteHeader(http.StatusOK)
done <- struct{}{}
}))
t.Cleanup(s.Close)