simonw / simonw/datasette

Populate "endpoint" key in ASGI scope

Open
#537 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature small
Dominant language
Python
Stars
11.5k
Forks
904
Avg merge
4d 17h
Merged PRs (30d)
18

Description

This is a trick used by Starlette so that other layers of ASGI middleware can see which route was selected.

They added it here: https://github.com/encode/starlette/commit/34d0097feb6f057bd050d5057df5a2f96b97384e

If Datasette supports it as well we can benefit from it if we integrate this sentry_asgi middleware (probably as a datasette-sentry plugin): https://github.com/encode/sentry-asgi/blob/c6a42d44d31f85885b79e4ee898683ecf8104971/sentry_asgi/middleware.py#L34-L35

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the referenced Starlette commit and sentry_asgi/middleware.py around lines 34-35 to understand the expected scope key. Then locate Datasette's ASGI routing and middleware entry point, determine where the selected route is available, and define tests showing the endpoint is present for middleware consumers.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.