Connexion: Incorrect set http response data when returning flask.Response objects

Created on 30 Nov 2016  路  2Comments  路  Source: zalando/connexion

Description

Incorrect set http response data when returning flask.Response objects

Expected bahaviour

From the documentation:

"If the endpoint returns a Response object this response will be used as is."

Actual behaviour

The response is parsed in connexion.decorators.decorator.BaseDecorator.get_full_response() and the response object itself is mistakenly set as the response's data instead of response.data:

This later throws a JSON serialize error when trying to JSON serialize the data variable (mistaken Response object)

Steps to reproduce

Additional info:

Output of the commands:

  • python --version
    Python 2.7.12
  • pip show connexion | grep "^Version\:"
    Version: 1.0.129
bug

Most helpful comment

I got it to work by replacing these lines

with this:

response = data
data = response.data
status_code = response.status_code
headers = response.headers

All 2 comments

I got it to work by replacing these lines

with this:

response = data
data = response.data
status_code = response.status_code
headers = response.headers

@heyglen Thank you for reporting it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

micmarty picture micmarty  路  3Comments

bioslikk picture bioslikk  路  4Comments

FRNCSCM picture FRNCSCM  路  4Comments

writeson picture writeson  路  4Comments

oddjobz picture oddjobz  路  3Comments