Skip to content

How can I set response headers? #236

Answered by barakalon
rimu asked this question in Q&A
Discussion options

You must be logged in to vote

Ah, this is indeed lacking in the documentation.

You can return a tuple of (response, status, headers) or (response, headers) from a view function, similar to Flask view functions: https://flask.palletsprojects.com/en/2.0.x/quickstart/#about-responses

Here’s the source code, if you want to see exactly how the response is interpreted: https://github.com/plangrid/flask-rebar/blob/master/flask_rebar/rebar.py#L78

Hope that helps.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@rimu
Comment options

Answer selected by rimu
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants