home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 636922104

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/datasette/issues/790#issuecomment-636922104 https://api.github.com/repos/simonw/datasette/issues/790 636922104 MDEyOklzc3VlQ29tbWVudDYzNjkyMjEwNA== 9599 2020-06-01T15:25:39Z 2020-06-01T15:25:39Z OWNER

What if I use a mutable key on scope to track messages for the duration of the request? Is that an OK thing to do?

ASGI spec says this: https://asgi.readthedocs.io/en/latest/specs/main.html#middleware

Middleware

It is possible to have ASGI "middleware" - code that plays the role of both server and application, taking in a scope and the send/receive awaitables, potentially modifying them, and then calling an inner application.

When middleware is modifying the scope, it should make a copy of the scope object before mutating it and passing it to the inner application, as changes may leak upstream otherwise. In particular, you should not assume that the copy of the scope you pass down to the application is the one that it ends up using, as there may be other middleware in the way; thus, do not keep a reference to it and try to mutate it outside of the initial ASGI constructor callable that receives scope. Your one and only chance to add to it is before you hand control to the child application.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
628499086  
Powered by Datasette · Queries took 5.772ms · About: github-to-sqlite