[Twisted-Python] treq POST abborting with: err: ('Could not adapt', '{"....", "..."} <InterfaceClass twisted.web.iweb.IBodyProducer>)

Tristan Seligmann mithrandi at mithrandi.net
Fri Jan 6 19:18:16 MST 2017


On Sat, 7 Jan 2017 at 03:23 Glyph Lefkowitz <glyph at twistedmatrix.com> wrote:

>
> Maybe we should support unicode for the body as well.  We can set the
> charset in the mime-type and everything so that it will be properly
> intelligible by the server, which doesn't happen if the user manually
> encodes like this.
>

Oh, forgot to comment on this point; in the specific case of JSON, it isn't
necessary to specify UTF-8 in Content-Type[1], but for HTML or XML it's a
pretty good idea. However, I'm not sure if it's possible to modify
Content-Type in a generic fashion to make this sort of thing work; for
example, "Content-Type: application/octet-stream; charset=UTF-8" is
nonsense. I'll defer to some HTTP experts here ;)

[1] https://tools.ietf.org/html/rfc7159#section-8.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20170107/1c4d1e7d/attachment-0002.html>


More information about the Twisted-Python mailing list