I'm trying to do a PUT request with an encrypted body and getting a decode error
UnicodeDecodeError: 'utf8' codec can't decode byte 0xed in position 0: invalid continuation byte
and the last bit of the traceback is
/usr/local/lib/python2.7/dist-packages/httpretty/utils.pyc in decode_utf8(s)
40 def decode_utf8(s):
41 if isinstance(s, byte_type):
---> 42 s = s.decode("utf-8")
43
44 return text_type(s)
/usr/lib/python2.7/encodings/utf_8.pyc in decode(input, errors)
14
15 def decode(input, errors='strict'):
---> 16 return codecs.utf_8_decode(input, errors, True)
17
18 class IncrementalEncoder(codecs.IncrementalEncoder):
Looks like HTTPretty is trying to decode my body as UTF-8 but my body has no encoding. If I was to comment out 41-44 in utils.py and return s it works as I would expected. I don't know much about encoding and am hesitant to suggest a solution, but should this be so strict? Is it possible to just do a try except here?
I'm trying to do a PUT request with an encrypted body and getting a decode error
and the last bit of the traceback is
Looks like HTTPretty is trying to decode my body as
UTF-8
but my body has no encoding. If I was to comment out 41-44 inutils.py
andreturn s
it works as I would expected. I don't know much about encoding and am hesitant to suggest a solution, but should this be so strict? Is it possible to just do a try except here?