-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] runbot_merge: return proper http responses from webhooks
The old controller system required `type='json'` which only did JSON-RPC and prevented returning proper responses. As of 17.0 this is not the case anymore, `type='http'` controllers can get `content-type: application/json` requests just fine and return whatever they want. So change that: - `type='json'`. - Return `Response` objects with nice status codes (and text mimetypes, as otherwise werkzeug defaults to html). - Update ping to bypass normal flow as otherwise it requires authentication and event sources which is annoying (it might be a good idea to have both in order to check for configuration, however it's not possible to just send a ping via the webhook UI on github so not sure how useful that would be). - Add some typing and improve response messages while at it. Note: some "internal" errors (e.g. ignoring event actions) are reported as successes because as far as I can tell webhooks only support success (2xy) / failure (4xy, 5xy) and an event that's ignored is not really *failed* per se. Some things are reported as failures even though they are on the edge because that can be useful to see what's happening e.g. comment too large or unable to lock rows. Fixes #1019
- Loading branch information
Showing
2 changed files
with
112 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters