{"html_url": "https://github.com/simonw/datasette/issues/537#issuecomment-513442743", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/537", "id": 513442743, "node_id": "MDEyOklzc3VlQ29tbWVudDUxMzQ0Mjc0Mw==", "user": {"value": 647359, "label": "tomchristie"}, "created_at": "2019-07-20T06:50:47Z", "updated_at": "2019-07-20T06:50:47Z", "author_association": "NONE", "body": "Right now the spec does say \u201ccopy the scope, rather than mutate it\u201d https://asgi.readthedocs.io/en/latest/specs/main.html#middleware \r\n\r\nI wouldn\u2019t be surprised if that there\u2019s room for discussion on evolving the exact language there.\r\n\r\nThere\u2019s obvs a nice element to the strictness there, tho practically I\u2019m not sure it\u2019s something that implementations will follow, and its not something that Starlette chooses to abide by.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 463544206, "label": "Populate \"endpoint\" key in ASGI scope"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/537#issuecomment-513279397", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/537", "id": 513279397, "node_id": "MDEyOklzc3VlQ29tbWVudDUxMzI3OTM5Nw==", "user": {"value": 647359, "label": "tomchristie"}, "created_at": "2019-07-19T15:47:57Z", "updated_at": "2019-07-19T15:48:09Z", "author_association": "NONE", "body": "The middleware implementation there works okay with a router nested inside if the scope is *mutated*. (Ie. \"endpoint\" doesn't need to exist at the point that the middleware starts running, but if it *has* been made available by the time an exception is thrown, then it can be used.)\r\n\r\nStarlette's usage of \"endpoint\" there is unilateral, rather than something I've discussed against the ASGI spec - certainly it's important for any monitoring ASGI middleware to be able to have some kind of visibility onto some limited subset of routing information, and `\"endpoint\"` in the scope referencing some routed-to callable seemed general enough to be useful.\r\n\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 463544206, "label": "Populate \"endpoint\" key in ASGI scope"}, "performed_via_github_app": null}