Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect check if body is a string #12

Open
udalrich opened this issue Jul 23, 2020 · 1 comment
Open

Incorrect check if body is a string #12

udalrich opened this issue Jul 23, 2020 · 1 comment

Comments

@udalrich
Copy link

The code checks if body is a string by doing if body.lower:. That passes if it is a string, but throws an exception if body is a io.BufferedReader, such as what one gets from

with open('someFile.bin', 'rb') as f:
  with boddle(body=f):
     pass

It would also fail if the file-like object happens to have a lower method/attribute

@keredson
Copy link
Owner

i think adding support for passing file-like objects in for body is a good idea. open to a PR. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants