Skip to content

Conversation

@nicholas-fedor
Copy link
Owner

This PR fixes a regression in the Generic service's ConfigFromWebhookURL function that was causing 400 Bad Request errors when using webhook URLs with configuration parameters (like ?template=json).

Problem

The issue was reported in nicholas-fedor/watchtower#826 where 400 errors were experienced with Notifiarr notifications using the Generic service, while Discord notifications worked fine. The root cause was that config properties from webhook URL query parameters were not being set, causing incorrect defaults (plain text instead of JSON payloads).

Solution

  • Fixed ConfigFromWebhookURL: Simplified the function to properly set config properties from webhook URL query parameters by calling SetConfigPropsFromQuery directly on unescaped query parameters after stripping custom values.
  • Enhanced testing: Added regression tests and testable examples for ConfigFromWebhookURL functionality.

Additional Changes

  • Improved code quality: Added detailed inline comments.
  • Documentation updates: Created godoc with testable examples and updated MkDocs documentation.

Changes

  • pkg/services/specialized/generic/generic_config.go: Fixed ConfigFromWebhookURL regression
  • pkg/services/specialized/generic/generic.go: Added inline comments
  • pkg/services/specialized/generic/custom_query.go: Added inline comments
  • pkg/services/specialized/generic/generic_test.go: Integrated regression tests
  • pkg/services/specialized/generic/doc.go: Added comprehensive godoc documentation
  • pkg/services/specialized/generic/generic_example_test.go: Added testable examples
  • docs/services/specialized/generic/index.md: Updated MkDocs documentation
  • docs/services/specialized/generic/config.md: Created configuration reference

- fix ConfigFromWebhookURL to properly set config properties from webhook URL query parameters
- add comprehensive inline comments to all generic package files
- create godoc documentation with testable examples
- update MkDocs documentation with current functionality
- add regression tests for ConfigFromWebhookURL functionality
- add additional examples throughout documentation
@codecov
Copy link

codecov bot commented Oct 22, 2025

Codecov Report

❌ Patch coverage is 95.77465% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/services/specialized/generic/generic.go 92.30% 2 Missing ⚠️
pkg/services/specialized/generic/custom_query.go 91.66% 1 Missing ⚠️
Files with missing lines Coverage Δ
pkg/services/specialized/generic/generic_config.go 93.61% <100.00%> (+8.32%) ⬆️
pkg/services/specialized/generic/custom_query.go 91.11% <91.66%> (+1.36%) ⬆️
pkg/services/specialized/generic/generic.go 81.88% <92.30%> (+2.27%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nicholas-fedor nicholas-fedor merged commit ef6e731 into main Oct 22, 2025
13 checks passed
@nicholas-fedor nicholas-fedor deleted the fix/generic-webhook-config-parsing branch October 22, 2025 09:46
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.

1 participant