Interesting! Is it anywhere in the docs that context should not be modified by any route handlers? I thought that context just carries request context, including things that we want to keep there for duration of request.
Funnily enough, I don’t think so. I know that the two methods on it are tied to the request context, so maybe the way it is tied to a specific request only applies to those, and not any other data you shim onto it
Where would you keep data between different handlers that might be processing the same request? (e.g. the first handler authenticates, second one has business logic conditioned on authentication results). First handler's gotta pass state to second handler.
Looking at itty docs - looks like they put it in request rather than context: https://itty.dev/itty-router/middleware... will need to do some more digging. Thx for taking the time!
In general within itty, we use the request as the carrier agent for context because it’s the only guaranteed argument in a route handler. That said, assuming you pass more args to router.handle, each of those passes into every handler (in the same order), so you can use any of those as a transport.