Add support for custom headers in webhook API
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA
What does this MR do and why?
Add support for custom headers in webhook API
Relates to Support for custom webhook headers in the API (#455528 - closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
API only changes
How to set up and validate locally
- Create a project hook using the API
{ "url": "some-url", "custom_headers": [{ "key": "some-key", "value": "some-value" }] } - Open the UI and check that a hook with a
some-keyheader has been set, test the webhook and see if the value is passed correctly - Edit the hook using the API
Now, the hook should have both
{ "custom_headers": [{ "key": "some-other-key", "value": "some-value" }] }some-keyandsome-other-keycustom headers. - Use the set custom header endpoint:
PUT /projects/:id/hooks/:hook_id/custom_headers/some-keyTest the hook again and verify that the new value is sent in the header{ "value": "some-new-value" } - Delete a custom header:
DELETE /projects/:id/hooks/:hook_id/custom_headers/some-key. You can check in the UI that the custom header was removed. - Repeat these steps for groups (if you have an active license)
Edited by Niklas van Schrick