Closed rijenkii closed 1 week ago
See also: https://github.com/fastapi/fastapi/discussions/12786
HTTP Headers cannot be represented by a dict, as they can have duplicate entries. Example: Set-Cookie.
dict
Set-Cookie
As such type of starlette.exceptions.HTTPException's headers field should be typing.Mapping instead of dict, just like starlette.responses.Response's headers field: https://github.com/encode/starlette/blob/c2e3a39b09a613553ee03586589ed9cd0fbf07f3/starlette/responses.py#L27-L38
starlette.exceptions.HTTPException
headers
typing.Mapping
starlette.responses.Response
Summary
See also: https://github.com/fastapi/fastapi/discussions/12786
HTTP Headers cannot be represented by a
dict
, as they can have duplicate entries. Example:Set-Cookie
.As such type of
starlette.exceptions.HTTPException
'sheaders
field should betyping.Mapping
instead ofdict
, just likestarlette.responses.Response
'sheaders
field: https://github.com/encode/starlette/blob/c2e3a39b09a613553ee03586589ed9cd0fbf07f3/starlette/responses.py#L27-L38Checklist