Skip to content

Client crashes when no body in response #98

@Alexis-Jacob

Description

@Alexis-Jacob

When I was pushing data with a post to an API who wasn't returning a body. The client have a problem:

    self._helper.post(request, data=project_header)
  File "/usr/local/lib/python3.6/dist-packages/deepomatic/api/http_helper.py", line 307, in post
    return self.make_request(self.session.post, resource, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/deepomatic/api/http_helper.py", line 286, in make_request
    elif 'application/json' in response.headers['Content-Type']:
  File "/usr/local/lib/python3.6/dist-packages/requests/structures.py", line 54, in __getitem__
    return self._store[key.lower()][1]
KeyError: 'content-type'

This can be reproduce by having an API returning with drf something such as: (the API is wrong aswell)

return Response(status_code=201)

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty/easyEasy issue (less than one day)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions