-
Notifications
You must be signed in to change notification settings - Fork 183
Added text/plain decode handling for explicitly set content type #247
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
Conversation
- The old version of the client handled this out of the box - Added a test to ensure it works
See #234 |
This isn't quite the same issue, in my use case the content type is explicitly set to text/plain in the store operation but when getting the object, there is an exception:
This doesn't happen in the current version on pypi. There is a fairly simple workaround of setting a custom decoder when you configure the client but it seems the client should be able to handle plain text. |
Devil's advocate: Why |
@shuhaowu I didn't know about that, thanks for the tip. |
@seancribbs So I did a little more digging and discovered it makes no difference if it's unicode or string. My initial thinking was that unicode would be able to handle all the string cases as well as the unicode cases where as string would not be able to handle unicode data. I was actually going for something that was essentially a no-op. I discovered the client can't handle unicode data as a plain string currently. It seems from reading the new_binary deprecation doc the client expects an already encoded byte stream passed to
If that's the case I'll change the code, to just use I tried adding a test case with the utf-8 encoded data in the form above and found that it errors in Python's |
Just remember, |
I'm satisfied with this change unless there are additional objections. |
Ah, but here's a problem... you have a decoder but not an encoder. I'm of the mind to change this API significantly, but in the meantime can you add the encoder too? |
Thanks @wkral! |
Added text/plain decode handling for explicitly set content type
Edit: Updating the heading to make the change more clear