You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
openapi: 3.0.0
paths:
/aggregationtypes:
get:
responses:
"200":
description: OK
content:
"*/*":
schema:
items:
$ref: "#/components/schemas/AggregationTypeDTO"
type: array
"401":
description: Authorization token missing or invalid.
"404":
description: added by me -RD
"500":
description: Unknown Error.
tags:
- aggregationtypes
operationId: GetAggregationTypes
summary: Returns a collection of AggregationTypeDTO
As you can see in the above specification 401, 404, 500 responses have no content, which is valid OpenAPI specification (https://swagger.io/docs/specification/describing-responses/). But when I call this Get request I get the following error for cases when status code is 401 or 404:
Traceback (most recent call last):
File "C:/working/openapi3/my_main.py", line 49, in <module>
main()
File "C:/working/openapi3/my_main.py", line 16, in main
make_http_requests(api, get_list)
File "C:/working/openapi3/my_main.py", line 36, in make_http_requests
response = function()
File "C:\working\openapi3\openapi3\openapi.py", line 193, in __call__
**kwargs)
File "C:\working\openapi3\openapi3\paths.py", line 266, in request
expected_media = expected_response.content.get(content_type, None)
AttributeError: 'NoneType' object has no attribute 'get'
The text was updated successfully, but these errors were encountered:
robert-dzikowski
changed the title
AttributeError is thrown when response does not have content defined
AttributeError is thrown when response does not have content defined in the spec file
Mar 23, 2020
As you can see in the above specification 401, 404, 500 responses have no content, which is valid OpenAPI specification (https://swagger.io/docs/specification/describing-responses/). But when I call this Get request I get the following error for cases when status code is 401 or 404:
The text was updated successfully, but these errors were encountered: