Skip to content

Move Request.headers back to Mapping#7441

Merged
nateprewitt merged 1 commit into
mainfrom
headers_mapping
May 14, 2026
Merged

Move Request.headers back to Mapping#7441
nateprewitt merged 1 commit into
mainfrom
headers_mapping

Conversation

@nateprewitt
Copy link
Copy Markdown
Member

This PR partially reverts #7431, moving it back to Mapping instead of MutableMapping. While we typically expect the input to be mutable, dicts inferred to be dict[str, str] at creation are incompatible with MutableMapping[str, str | bytes] even though they may later have a bytes value added.

This typing decision is a tradeoff of supporting update() calls on Request.headers and requiring all users to type their input as dict[str, str | bytes]. The latter is significantly more invasive and common for current codebases.

@nateprewitt nateprewitt merged commit 84d10f0 into main May 14, 2026
85 of 86 checks passed
@nateprewitt nateprewitt deleted the headers_mapping branch May 14, 2026 16:16
@nateprewitt nateprewitt linked an issue May 14, 2026 that may be closed by this pull request
@nateprewitt nateprewitt mentioned this pull request May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mypy warns about invalid types for headers

2 participants