Unreleased changes

Changes that have landed on the main branch but are not yet part of a tagged release. These entries are assembled into the Changelog when the next release is published.

[UNRELEASED DRAFT]

  • Use types-httpretty to type-check the HTTPretty integration.

  • Escape regex meta-characters in literal URL components.

  • Preserve binary response bodies when using the requests_mock back end.

  • The intercepted request host and scheme are now preserved when forwarding to the Flask app.

  • Repeated response headers such as Set-Cookie and Warning are now preserved by the responses and requests_mock back ends instead of being collapsed to a single value.

  • Route patterns are now anchored so that a rule such as /api no longer intercepts unrelated paths such as /api-extra, while still matching an optional query string.

  • Path prefixes supplied in base_url are now preserved when registering Flask routes.

  • Requests using an unsupported method for a known route are now forwarded to Flask, which returns its usual 405 Method Not Allowed response.

  • Requests to the form without a trailing slash of a slash-terminated Flask route are now forwarded so that Flask can produce its trailing-slash redirect.

  • Percent-encode the static portions of route paths so that non-ASCII routes such as /café are reachable through the mock.

  • Custom framework converters that set part_isolating = False now correctly match values containing slashes.

  • The scheme and host of base_url are now normalized to lowercase so that requests to case-insensitive URL components are intercepted.

  • Duplicate request cookies with the same name are now preserved instead of being collapsed to the last value.

  • Forward the original Cookie header verbatim so valueless cookie tokens are preserved in forwarded requests.

  • Forward the original Cookie header to Flask instead of re-parsing it, so requests with cookie names that the framework accepts but SimpleCookie rejects no longer crash.

  • Support iterable streaming request bodies with the responses and requests-mock backends.

  • Custom HTTP reason phrases from Flask responses are now preserved for the requests_mock back end.

  • Prevent HTTPretty from crashing on nonstandard Flask status codes.

  • URL interception now honors Flask converter constraints, so requests that violate a route’s converter (for example a non-integer where <int:...> is expected) are left unmatched instead of being forwarded.

  • Host-constrained Flask rules are now only registered against a base_url whose host matches the rule’s host.

  • Internationalized base_url host names are now normalized to their IDNA form so that internationalized routes are intercepted.

  • Forwarded Flask responses are now closed so call_on_close callbacks run.

  • Custom converter arguments containing a quoted > are no longer truncated when generating URL patterns, so applications that use them can be attached to a mock back end.