0

Hi i'm trying to test and endpoint that will need a file and some values, when i upload only the file there is not problem, but when i add the values it throws:

TypeError: 'str' does not support the buffer interface

my code is like this:

headers = {'content-Type': 'multipart/form-data'}
response = self.client.post(base_url, headers=headers, data=dict(
some_value='test', some_other_value=False, image=(BytesIO(self.test_image), 'image.png'))

if i do this it works:

headers = {'content-Type': 'multipart/form-data'}
    response = self.client.post(base_url, headers=headers, data=dict(
    image=(BytesIO(self.test_image), 'image.png'))
Chris Gomez
  • 6,644
  • 4
  • 18
  • 39

1 Answers1

0

Don't know what it have to be with anything of that but, when I changed from False in a value to 'false' it worked.

Chris Gomez
  • 6,644
  • 4
  • 18
  • 39