Context
- Dependencies can request a
request context dict built in src/params.rs (build_request_context).
- Headers are copied entirely into a Python dict when any dependency wants
request.
Problem
Raw dict API is weak for middleware, auth, and observability. Full header clone is expensive when deps only read one header.
Proposed change
- Introduce
oxyroute.Request with typed accessors: method, path, query_string, headers, client, cookies (minimal MVP).
- Lazy header materialization or read-through wrapper; copy only on access.
- Preserve compatibility: existing
request["headers"] dict path or migration shim.
Files
oxyroute/ (new request.py or similar), src/params.rs, src/dispatch.rs
docs/dependencies.md, tests
Acceptance criteria
- Dependency
request injection works with new type (and legacy dict if kept).
- Routes that do not touch headers avoid full header copy.
- Docs show new API and migration notes.
Framework impact
Foundation for middleware, auth helpers, observability, and future typed utilities.
Context
requestcontext dict built insrc/params.rs(build_request_context).request.Problem
Raw dict API is weak for middleware, auth, and observability. Full header clone is expensive when deps only read one header.
Proposed change
oxyroute.Requestwith typed accessors:method,path,query_string,headers,client,cookies(minimal MVP).request["headers"]dict path or migration shim.Files
oxyroute/(newrequest.pyor similar),src/params.rs,src/dispatch.rsdocs/dependencies.md, testsAcceptance criteria
requestinjection works with new type (and legacy dict if kept).Framework impact
Foundation for middleware, auth helpers, observability, and future typed utilities.