Skip to content

Commit 8f6c629

Browse files
author
Shane DeWael
committed
Update request signing to work for any content type
1 parent 6a269ed commit 8f6c629

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

slackeventsapi/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def verify_signature(self, timestamp, signature):
5353
# It's recommended to use Python 2.7.7+
5454
# noqa See https://docs.python.org/2/whatsnew/2.7.html#pep-466-network-security-enhancements-for-python-2-7
5555
if hasattr(hmac, "compare_digest"):
56-
req = str.encode('v0:' + str(timestamp) + ':') + request.data
56+
req = str.encode('v0:' + str(timestamp) + ':') + request.get_data()
5757
request_hash = 'v0=' + hmac.new(
5858
str.encode(self.signing_secret),
5959
req, hashlib.sha256
@@ -65,7 +65,7 @@ def verify_signature(self, timestamp, signature):
6565
return hmac.compare_digest(request_hash, signature)
6666
else:
6767
# So, we'll compare the signatures explicitly
68-
req = str.encode('v0:' + str(timestamp) + ':') + request.data
68+
req = str.encode('v0:' + str(timestamp) + ':') + request.get_data()
6969
request_hash = 'v0=' + hmac.new(
7070
str.encode(self.signing_secret),
7171
req, hashlib.sha256

0 commit comments

Comments
 (0)