Skip to content

Commit 6967276

Browse files
author
Ahmed Awad
committed
Modify _get_digest to use request.get_data().
* request.data is empty when the request type is application/x-www-form-urlencoded * request.get_data contains the raw request bytes, cached by flask, and that works for both application/json and application/x-www-form-urlencoded Signed-Off-By: Ahmed Awad <[email protected]>
1 parent 8d3ad24 commit 6967276

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

github_webhook/webhook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def decorator(func):
4242
def _get_digest(self):
4343
"""Return message digest if a secret key was provided"""
4444

45-
return hmac.new(self._secret, request.data, hashlib.sha1).hexdigest() if self._secret else None
45+
return hmac.new(self._secret, request.get_data(), hashlib.sha1).hexdigest() if self._secret else None
4646

4747
def _postreceive(self):
4848
"""Callback from Flask"""

0 commit comments

Comments
 (0)