vapor-ware / fastapi-rfc7807

RFC-7807 compliant problem detail error response handler for FastAPI applications
GNU General Public License v3.0
19 stars 7 forks source link

add support for setting response headers on Problem subclasses #13

Closed edaniszewski closed 3 years ago

edaniszewski commented 3 years ago

e.g. if we have a subclass of error which we want to include a response header when it is raised and an error returned, we should be able to do so by defining it on the error class subtype.

class Custom(Problem):

    headers = {
        'some-header': 'foobar'
    }

we may want to also have a way to set more dynamic headers, but I think that is a separate future issue.