Change8

v2.34.1

📦 requestsView on GitHub →
🐛 4 fixes🔧 3 symbols

Summary

This patch release primarily focuses on improving type safety and handling for inputs and responses, specifically widening JSON input types and tightening header and response reason types.

Migration Steps

  1. If you were relying on `Request.headers` being potentially `None`, update your code as it is now guaranteed to be a `MutableMapping`.
  2. If you were relying on `Response.reason` being `None` in certain cases, update your code as it is now guaranteed to be a `str`.

🐛 Bug Fixes

  • Widened `json` input type from `dict` and `list` to `Mapping` and `Sequence`.
  • Changed `headers` input type to MutableMapping and removed `None` from `Request.headers` typing.
  • `Response.reason` type changed from `str | None` to `str`.
  • Fixed a bug where some bodies with custom `__getattr__` implementations weren't being properly detected as Iterables.

Affected Symbols