Enable tuple responses with headers without status #938

Merged
merged 2 commits into from Feb 8, 2014

Conversation

3 participants
Contributor

ahlen commented Dec 31, 2013

Hi,

In my flask apps I've overridden the behavior of Flask.make_response to enable tuple responses with headers but skipping the status in the case of the default status (200). I know that this in practice only means a less coma and status, but thinks this enable a more beautiful way to return tuple responses with the default status code (or status directly passed into the Response constructor) but contains other headers.

So instead of today

@app.route("/")
def index():
    return "hi", 200, {"X-Foo": "Bar"} 

This PR enable us to write

@app.route("/")
def index():
    return "hi", {"X-Foo": "Bar"} 

ahlen added some commits Dec 31, 2013

Owner

mitsuhiko commented Feb 8, 2014

While this is magical I can see this being useful. Adding.

mitsuhiko added a commit that referenced this pull request Feb 8, 2014

Merge pull request #938 from ahlen/response-with-headers-without-status
Enable tuple responses with headers without status

@mitsuhiko mitsuhiko merged commit c9bf907 into pallets:master Feb 8, 2014

1 check failed

default The Travis CI build failed
Details

@ahlen ahlen deleted the ahlen:response-with-headers-without-status branch Feb 8, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment