Skip to content

fix: fix (reviewed): Webhook retry logic uses incorrect HTTP method on retries - #172

Open
Muyideen-js wants to merge 2 commits into
Savitura:mainfrom
Muyideen-js:solver/issue-132-121-a0
Open

fix: fix (reviewed): Webhook retry logic uses incorrect HTTP method on retries#172
Muyideen-js wants to merge 2 commits into
Savitura:mainfrom
Muyideen-js:solver/issue-132-121-a0

Conversation

@Muyideen-js

Copy link
Copy Markdown

Summary

Fixed webhook retry logic to preserve the original HTTP method across retries.

Root cause: service.go's Deliver method hardcoded http.MethodPost when constructing the retry request, ignoring the original request method stored on the delivery. This caused POST webhooks to be retried as GET requests.

Changes:

  1. Added Method field to domain.WebhookDelivery struct.
  2. Added a new migration (20260407000000_webhook_delivery_method) adding a method TEXT NOT NULL DEFAULT 'POST' column to webhook_deliveries.
  3. Updated webhook_repo.go (CreateDelivery, GetDelivery, ListDeliveries) to persist and read the method column.
  4. Updated dispatcher.go to set Method: http.MethodPost when creating a delivery.
  5. Updated service.go's Deliver to use the stored deliv.Method (falling back to POST for legacy rows) instead of hardcoded http.MethodPost.
  6. Added regression test TestWebhookService_RetryPreservesHTTPMethod verifying the retry uses the original POST method after a 503 failure.

Changed files

  • db/migrations/20260407000000_webhook_delivery_method.down.sql
  • db/migrations/20260407000000_webhook_delivery_method.up.sql
  • internal/domain/webhook.go
  • internal/postgres/webhook_repo.go
  • internal/webhook/dispatcher.go
  • internal/webhook/service.go
  • internal/webhook/service_test.go

Test plan

Run go test ./internal/webhook/... to verify the new regression test and existing webhook tests pass. Run go build ./... to confirm compilation. The regression test spins up a mock webhook server returning 503 on the first attempt and verifies both attempts use the POST method.

This PR was created as a draft by the issue solver bot. It will remain a
draft until repository CI passes.

Closes #132

@drips-wave

drips-wave Bot commented Sep 1, 2026

Copy link
Copy Markdown

@Muyideen-js Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Muyideen-js
Muyideen-js marked this pull request as ready for review September 1, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix (reviewed): Webhook retry logic uses incorrect HTTP method on retries

2 participants