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?

Arkady
  • 14,305
  • 8
  • 42
  • 46

1 Answers1

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'}
Arkady
  • 14,305
  • 8
  • 42
  • 46