httpx icon indicating copy to clipboard operation
httpx copied to clipboard

Relax `HeaderTypes` type alias definition

Open willfrey opened this issue 3 years ago • 1 comments

This replaces Dict[..., ...] with Mapping[..., ...] in the union definition for HeaderTypes. Closes #2314.

  • [x] Initially raised as discussion #2314

willfrey avatar Jul 21 '22 14:07 willfrey

If there's interest, I'd be happy to try to do the same for the following type definitions in separate PRs, replacing Dict with Mapping or MutableMapping and List with Sequence, MutableSequence, or Iterable, depending on what the actual constraints are in the implementations.

https://github.com/encode/httpx/blob/93de1980fa77f15c6b23cbaf2422c0a812caf243/httpx/_types.py#L35-L42

https://github.com/encode/httpx/blob/93de1980fa77f15c6b23cbaf2422c0a812caf243/httpx/_types.py#L52

https://github.com/encode/httpx/blob/93de1980fa77f15c6b23cbaf2422c0a812caf243/httpx/_types.py#L68

willfrey avatar Jul 29 '22 15:07 willfrey

Seems reasonable, yes.

lovelydinosaur avatar Aug 30 '22 11:08 lovelydinosaur