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
ASGI Specification in the Response Start says that if I send http.response.start, the headers part should be of the following form:
(Iterable[[byte string, byte string]])
A iterable of [name, value] two-item iterables, where name is the header name, and value is the header value. Order must be preserved in the HTTP response. Header names must be lowercased. Optional; defaults to an empty list.
So let's have an ASGI compliant application of the following form:
After requesting this I get the following in the console:
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/home/jerzy/venv/lib/python3.7/site-packages/uvicorn/protocols/http/httptools_impl.py", line 368, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "./asgi.py", line 9, in application
"status": 200,
File "/home/jerzy/venv/lib/python3.7/site-packages/uvicorn/protocols/http/httptools_impl.py", line 427, in send
headers = self.default_headers + message.get("headers", [])
TypeError: can only concatenate list (not "tuple") to list
Looks like the headers have to be list of list, not simple iterable of 2-items iterable. Do you think this is important? If we want to be 100% compliant with ASGI spec uvicorn should handle just any iterables. If you agree, do you think I could prepare a patch?
The text was updated successfully, but these errors were encountered:
ASGI Specification in the
Response Start
says that if I sendhttp.response.start
, theheaders
part should be of the following form:(Iterable[[byte string, byte string]])
So let's have an ASGI compliant application of the following form:
After requesting this I get the following in the console:
Looks like the headers have to be list of list, not simple iterable of 2-items iterable. Do you think this is important? If we want to be 100% compliant with ASGI spec uvicorn should handle just any iterables. If you agree, do you think I could prepare a patch?
The text was updated successfully, but these errors were encountered: