mirror of
https://github.com/LukeHagar/connexion.git
synced 2025-12-09 12:27:46 +00:00
improved error 415 (#1185)
* improved error 415 * test added * Fix tests for updated 415 error response Co-authored-by: unknown <parthsujalshah@gmail.com.com> Co-authored-by: Ruwan <ruwanlambrichts@gmail.com>
This commit is contained in:
@@ -78,3 +78,11 @@ def test_errors(problem_app):
|
||||
problem_as_exception_body = json.loads(problem_as_exception.data.decode('utf-8', 'replace'))
|
||||
assert 'age' in problem_as_exception_body
|
||||
assert problem_as_exception_body['age'] == 30
|
||||
|
||||
unsupported_media_type = app_client.post('/v1.0/post_wrong_content_type', data='<html></html>', content_type='text/html')
|
||||
assert unsupported_media_type.status_code == 415
|
||||
unsupported_media_type_body = json.loads(unsupported_media_type.data.decode('utf-8', 'replace'))
|
||||
assert unsupported_media_type_body['type'] == 'about:blank'
|
||||
assert unsupported_media_type_body['title'] == 'Unsupported Media Type'
|
||||
assert unsupported_media_type_body['detail'] == 'Invalid Content-type (text/html), expected JSON data'
|
||||
assert unsupported_media_type_body['status'] == 415
|
||||
|
||||
Reference in New Issue
Block a user