As suggested by @Kludex
ASGI protocol might take advantage of granian capability of directly serve files from a path, like already implemented in RSGI proto.response_file.
This would require to open up a PR to https://github.com/django/asgiref adding the new extra, which might look like the following:
"scope": {
...
"extensions": {
"http.response.file_path": {},
},
}
With the above extra definition, a new event might be produced by ASGI applications, with the following keys:
type (Unicode string): "http.response.file_path"
file_path (Unicode string): The string representation of the file path to serve (platform specific)
The ASGI application is still responsible to send the http.response.start event with the relevant headers (eg: content-type, content-length, etc.)
As suggested by @Kludex
ASGI protocol might take advantage of granian capability of directly serve files from a path, like already implemented in RSGI
proto.response_file.This would require to open up a PR to https://github.com/django/asgiref adding the new extra, which might look like the following:
With the above extra definition, a new event might be produced by ASGI applications, with the following keys:
type(Unicode string): "http.response.file_path"file_path(Unicode string): The string representation of the file path to serve (platform specific)The ASGI application is still responsible to send the
http.response.startevent with the relevant headers (eg:content-type,content-length, etc.)