Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix aiohttp get_response test and add debug to understand better
  • Loading branch information
cognifloyd committed Dec 7, 2019
commit d49b5241d748b1e5600cc8128ee31534ef8820ed
2 changes: 2 additions & 0 deletions connexion/apis/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,11 @@ def _serialize_data(cls, data, mimetype):
except TypeError:
# or let objects self-serialize
body = str(data)
logger.debug('_serialize_data mimetype=None and str()')
else:
mimetype = DEFAULT_MIMETYPE
else:
logger.debug('_serialize_data mimetype={} and str()'.format(mimetype))
body = str(data)
else:
body = data
Expand Down
5 changes: 2 additions & 3 deletions tests/aiohttp/test_get_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ def test_get_response_from_dict(api):
assert isinstance(response, web.Response)
assert response.status == 200
assert json.loads(response.body.decode()) == {"foo": "bar"}
# get_response does not modify the mimetype or content_type magically. It only simplifies serialization.
assert response.content_type == 'text/plain'
assert dict(response.headers) == {'Content-Type': 'text/plain; charset=utf-8'}
assert response.content_type == 'application/json'
assert dict(response.headers) == {'Content-Type': 'application/json; charset=utf-8'}


@asyncio.coroutine
Expand Down