Skip to content

Commit 0295f50

Browse files
committed
bug fix
1 parent 7de7688 commit 0295f50

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

oauth2/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,9 @@ def sign_request(self, signature_method, consumer, token):
490490
# section 4.1.1 "OAuth Consumers MUST NOT include an
491491
# oauth_body_hash parameter on requests with form-encoded
492492
# request bodies."
493-
self['oauth_body_hash'] = base64.b64encode(sha1('{}'.format(self.body)).digest())
493+
if not self.body:
494+
self.body = ''
495+
self['oauth_body_hash'] = base64.b64encode(sha1(self.body).digest())
494496

495497
if 'oauth_consumer_key' not in self:
496498
self['oauth_consumer_key'] = consumer.key

0 commit comments

Comments
 (0)