Skip to content

Commit

Permalink
Handle POST request without body in example client
Browse files Browse the repository at this point in the history
When sending a POST request in the client example, we convert its
body to bytes to create the HMAC key. This fails when there is no
body because the ToBytes function does not handle the None value.
Return empty bytes in this case.
  • Loading branch information
micbou committed Sep 8, 2016
1 parent b540c06 commit 81884b3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/example_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ def _CallHttpie( self, method, handler, data = None ):


def ToBytes( value ):
if not value:
return bytes()
if isinstance( value, bytes ):
return value
if isinstance( value, int ):
Expand Down

0 comments on commit 81884b3

Please sign in to comment.