You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 15, 2020. It is now read-only.
Is your feature request related to a problem? Please describe.
We may want to send extra headers along with the response when an HTTP error occurs — particularly when dealing with authentication. We cannot do so currently without writing a custom error handler that would define the format of the response (plain text, JSON, …).
Describe the solution you'd like
Add a headers parameter to HTTPError, which users/clients can use to define extra headers to be sent with the response.
Is your feature request related to a problem? Please describe.
We may want to send extra headers along with the response when an HTTP error occurs — particularly when dealing with authentication. We cannot do so currently without writing a custom error handler that would define the format of the response (plain text, JSON, …).
Describe the solution you'd like
Add a
headers
parameter toHTTPError
, which users/clients can use to define extra headers to be sent with the response.Describe alternatives you've considered
HTTPError
to be a subclass of Starlette'sHTTPException
(see RefactorHTTPError
as a subclass of Starlette'sHTTPException
#274), and push this feature to the upstream Starlette project => incompatible with the philosophy of Starlette as an ASGI toolkit - see Add custom headers to HTTPException encode/starlette#507.Implementation ideas
We'll need to update the base error handlers (
error_to_text
,error
to_json`, etc) to send the extra headers with the response.Additional context
/
The text was updated successfully, but these errors were encountered: