Header names from scope not lowercased in datastructures.Headers constructor #2759
-
starlette/starlette/datastructures.py Line 505 in ad7ff08 starlette/starlette/datastructures.py Line 512 in ad7ff08 According to the ASGI specification "header names should be lowercased, but it is not required". I ran into this because I was testing some middleware by directly calling it instead of through a ASGI server. I spent more than an hour trying to figure out why |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I can see why it would be frustrating, but I can also see why the behavior is the way it is: Also, both It's also the first time I see this complaint. I'd say the current behavior is fine. |
Beta Was this translation helpful? Give feedback.
I can see why it would be frustrating, but I can also see why the behavior is the way it is:
scope["headers"]
would be the same as passing theraw
, which doesn't need to do the lower casing.Also, both
TestClient
andhttpx.AsyncClient
(ASGI) do the lower casing of headers...It's also the first time I see this complaint. I'd say the current behavior is fine.