Skip to content

Commit

Permalink
Add support for files as request body
Browse files Browse the repository at this point in the history
  • Loading branch information
USSRLivesOn authored and tedder committed Mar 24, 2022
1 parent 30df596 commit d40ca0a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions requests_aws4auth/aws4auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ def __call__(self, req):

# encode body and generate body hash
if hasattr(req, 'body') and req.body is not None:
if hasattr(req.body, 'read'):
req.body = req.body.read()
self.encode_body(req)
content_hash = hashlib.sha256(req.body)
elif hasattr(req, 'content') and req.content is not None:
Expand Down

0 comments on commit d40ca0a

Please sign in to comment.