From fea51c61a46ecf190a1734508815f9da6db50be2 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 23 Jan 2025 10:49:42 +0100 Subject: [PATCH] webhooks: add User-Agent to outgoing requests --- webhooks/legacy.go | 1 + webhooks/queue.go | 1 + 2 files changed, 2 insertions(+) diff --git a/webhooks/legacy.go b/webhooks/legacy.go index 7a92006bb0b25aae8397283df79edd3ccd8f20a6..ec62b0a499384220da664d884c4c66c0f22db4bc 100644 --- a/webhooks/legacy.go +++ b/webhooks/legacy.go @@ -161,6 +161,7 @@ func (lq *LegacyQueue) queueStage2(ctx context.Context, tx *sql.Tx, deliveryUUID := uuid.New().String() headers := make(http.Header) headers.Set("Content-Type", "application/json") + headers.Set("User-Agent", "SourceHut core-go (https://git.sr.ht/~sircmpwn/core-go) webhook queue") headers.Set("X-Webhook-Event", event) headers.Set("X-Webhook-Delivery", deliveryUUID) var sb strings.Builder diff --git a/webhooks/queue.go b/webhooks/queue.go index 2081043031ed2b469ec07ea1e5e4530b1c009792..1523bf96838a87aa2e98e64860e07d21e7384d57 100644 --- a/webhooks/queue.go +++ b/webhooks/queue.go @@ -171,6 +171,7 @@ func (queue *WebhookQueue) queueStage2(ctx context.Context, tx *sql.Tx, webhook *WebhookContext) (*work.Task, error) { headers := make(http.Header) headers.Set("Content-Type", "application/json") + headers.Set("User-Agent", "SourceHut core-go (https://git.sr.ht/~sircmpwn/core-go) webhook queue") headers.Set("X-Webhook-Event", webhook.Event) headers.Set("X-Webhook-Delivery", webhook.PayloadUUID.String())