From 3569ab40b893dc362e663ee9edd802e6530d1361 Mon Sep 17 00:00:00 2001 From: jolheiser Date: Mon, 4 Oct 2021 22:35:30 -0500 Subject: [PATCH 1/2] Add specific event type to header Signed-off-by: jolheiser --- services/webhook/deliver.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/services/webhook/deliver.go b/services/webhook/deliver.go index abdbed0d5fb1b..8ccdefb213ff0 100644 --- a/services/webhook/deliver.go +++ b/services/webhook/deliver.go @@ -113,16 +113,21 @@ func Deliver(t *models.HookTask) error { signatureSHA256 = hex.EncodeToString(sig256.Sum(nil)) } + event := t.EventType.Event() + eventSingle := string(t.EventType) req.Header.Add("X-Gitea-Delivery", t.UUID) - req.Header.Add("X-Gitea-Event", t.EventType.Event()) + req.Header.Add("X-Gitea-Event", event) + req.Header.Add("X-Gitea-Event-Single", eventSingle) req.Header.Add("X-Gitea-Signature", signatureSHA256) req.Header.Add("X-Gogs-Delivery", t.UUID) - req.Header.Add("X-Gogs-Event", t.EventType.Event()) + req.Header.Add("X-Gogs-Event", event) + req.Header.Add("X-Gogs-Event-Single", eventSingle) req.Header.Add("X-Gogs-Signature", signatureSHA256) req.Header.Add("X-Hub-Signature", "sha1="+signatureSHA1) req.Header.Add("X-Hub-Signature-256", "sha256="+signatureSHA256) req.Header["X-GitHub-Delivery"] = []string{t.UUID} - req.Header["X-GitHub-Event"] = []string{t.EventType.Event()} + req.Header["X-GitHub-Event"] = []string{event} + req.Header["X-GitHub-Event-Single"] = []string{eventSingle} // Record delivery information. t.RequestInfo = &models.HookRequest{ From 7b86a931b3f51206af84c3469c453605c58ea01c Mon Sep 17 00:00:00 2001 From: John Olheiser Date: Tue, 5 Oct 2021 08:37:18 -0500 Subject: [PATCH 2/2] Change single to type --- services/webhook/deliver.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/webhook/deliver.go b/services/webhook/deliver.go index 8ccdefb213ff0..28c3b23b2f896 100644 --- a/services/webhook/deliver.go +++ b/services/webhook/deliver.go @@ -114,20 +114,20 @@ func Deliver(t *models.HookTask) error { } event := t.EventType.Event() - eventSingle := string(t.EventType) + eventType := string(t.EventType) req.Header.Add("X-Gitea-Delivery", t.UUID) req.Header.Add("X-Gitea-Event", event) - req.Header.Add("X-Gitea-Event-Single", eventSingle) + req.Header.Add("X-Gitea-Event-Type", eventType) req.Header.Add("X-Gitea-Signature", signatureSHA256) req.Header.Add("X-Gogs-Delivery", t.UUID) req.Header.Add("X-Gogs-Event", event) - req.Header.Add("X-Gogs-Event-Single", eventSingle) + req.Header.Add("X-Gogs-Event-Type", eventType) req.Header.Add("X-Gogs-Signature", signatureSHA256) req.Header.Add("X-Hub-Signature", "sha1="+signatureSHA1) req.Header.Add("X-Hub-Signature-256", "sha256="+signatureSHA256) req.Header["X-GitHub-Delivery"] = []string{t.UUID} req.Header["X-GitHub-Event"] = []string{event} - req.Header["X-GitHub-Event-Single"] = []string{eventSingle} + req.Header["X-GitHub-Event-Type"] = []string{eventType} // Record delivery information. t.RequestInfo = &models.HookRequest{