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
I have an endpoint which returns pdf file. Thus I do something that converts into
registry.add_handler(*args, response_body_schema={200: None}, mimetype='application/pdf').
I want to say that normal reponse code is 200 and marshmallow schema is not applicable. (I used the same technique in order to return just string issue #184 )
later I get
trace="Traceback (most recent call last):
File "/opt/opsta/hub-live/py/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/opt/opsta/hub-live/py/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/opt/opsta/hub-live/py/lib/python2.7/site-packages/flask_rebar/rebar.py", line 156, in wrapped
data=data, status_code=status_code, headers=headers, mimetype=mimetype
File "/opt/opsta/hub-live/py/lib/python2.7/site-packages/flask_rebar/utils/request_utils.py", line 66, in response
resp = jsonify(data) if data is not None else Response()
File "/opt/opsta/hub-live/py/lib/python2.7/site-packages/flask/json.py", line 263, in jsonify
(dumps(data, indent=indent, separators=separators), '\n'),
File "/opt/opsta/hub-live/py/lib/python2.7/site-packages/flask/json.py", line 123, in dumps
rv = _json.dumps(obj, **kwargs)
File "/usr/lib64/python2.7/json/__init__.py", line 251, in dumps
sort_keys=sort_keys, **kw).encode(obj)
File "/usr/lib64/python2.7/json/encoder.py", line 209, in encode
chunks = list(chunks)
File "/usr/lib64/python2.7/json/encoder.py", line 442, in _iterencode
o = _default(o)
File "/opt/opsta/hub-live/py/lib/python2.7/site-packages/hub/core/json.py", line 16, in default
return super(HubJSONEncoder, self).default(obj)
File "/opt/opsta/hub-live/py/lib/python2.7/site-packages/flask/json.py", line 80, in default
return _json.JSONEncoder.default(self, o)
File "/usr/lib64/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <Response streamed [200 OK]> is not JSON serializable
"
so rebar doesn't care that return content type is not a json, so there's no need to apply json serialization and it doesn't tell swagger that this endpoint returns pdf, but lies about json.
The text was updated successfully, but these errors were encountered:
serj-p
changed the title
Rebar doesn't respect content type setting
Rebar doesn't respect mime type setting
Jun 16, 2020
I have an endpoint which returns pdf file. Thus I do something that converts into
registry.add_handler(*args, response_body_schema={200: None}, mimetype='application/pdf')
.I want to say that normal reponse code is 200 and marshmallow schema is not applicable. (I used the same technique in order to return just string issue #184 )
later I get
so rebar doesn't care that return content type is not a json, so there's no need to apply json serialization and it doesn't tell swagger that this endpoint returns pdf, but lies about json.
The text was updated successfully, but these errors were encountered: