pass `request` instead of `environ` where possible
Author: davidismCreated Sep 18, 2026Updated Sep 18, 2026
`Request` has a bunch of header properties that cache the result of parsing. Werkzeug has a bunch of individual functions that work on `environ`, meaning everything needs to be re-parsed everywhere. Some functions (but not consistently) accept a `Request` or `environ`, but then pick `request.environ`, so they're not actually benefiting. Look into preferring `Request` over `environ`, and possibly deprecating `environ`. This will also benefit sans-io and asgi work, as it will no longer be wsgi-specific.
Source: pallets/werkzeug