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
We have an API spec in which we have a download operation that is supposed to return application/octet-stream (with status code 200). In case something is wrong with the user input another status codes are defined (400 and 404) that are supposed to return application/json.
This seems impossible to achieve with connexion. It always assumes application/json mime type and attempts to parse the JSON before sending the response.
first checks if all returned mime types are the same and then (if this is not the case) - it only allows a non-JSON mime type if there is just one type defined:
HI @aigielsk, handling multiple mimetypes on the same endpoint is indeed a current limitation of connexion (see #653). You can work around this by returning a response object with the correct mimetype set.
We have an API spec in which we have a download operation that is supposed to return
application/octet-stream
(with status code200
). In case something is wrong with the user input another status codes are defined (400
and404
) that are supposed to returnapplication/json
.This seems impossible to achieve with
connexion
. It always assumesapplication/json
mime type and attempts to parse the JSON before sending the response.Some details:
The method
get_mimetype
:connexion/connexion/operations/abstract.py
Line 327 in ca70b16
connexion/connexion/operations/abstract.py
Lines 339 to 340 in ca70b16
Otherwise it returns the
DEFAULT_MIMETYPE
, which isapplication/json
.It should be possible to define the returned mime type per returned status code.
The text was updated successfully, but these errors were encountered: