Skip to content

Implement ASGI extra http.response.pathsend #82

@gi0baro

Description

@gi0baro

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    asgiIssue related to ASGI protocolpycon

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions