2

I am using Flask-RESTful and would like to handle certain errors by adding a custom HTTP header to my response. Is there a standard Flask or Flask-RESTful way of doing this?

2

1 Answer 1

9

Turns out I skipped over that part of the docs:

class Todo3(Resource):
    def get(self):
        # Set the response code to 201 and return custom headers
        return {'task': 'Hello world'}, 201, {'Etag': 'some-opaque-string'}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.