Skip to content

Commit 47864ff

Browse files
author
Aidan Delaney
committed
Allowed hooks to return own HTTP response
Hooks may need to return a 400 if the client has send an incorrect payload. The HTTP response generated by the hook is now returned to the HTTP client iff the resposne is not None.
1 parent 0ca781b commit 47864ff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

github_webhook/webhook.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ def _postreceive(self):
6969
'%s (%s)', _format_event(event_type, data), _get_header('X-Github-Delivery'))
7070

7171
for hook in self._hooks.get(event_type, []):
72-
hook(data)
72+
resp = hook(data)
73+
if resp: # Allow hook to respond if necessary
74+
return resp
7375

7476
return '', 204
7577

0 commit comments

Comments
 (0)