2026.08.16¶
Use
types-httprettyto type-check the HTTPretty integration.Escape regex meta-characters in literal URL components.
Preserve binary response bodies when using the
requests_mockback end.The intercepted request host and scheme are now preserved when forwarding to the Flask app.
The
responsesandrequests_mockback ends preserve repeated response headers such asSet-CookieandWarning.Route patterns are now anchored so that a rule such as
/apino longer intercepts unrelated paths such as/api-extra, while still matching an optional query string.Path prefixes supplied in
base_urlare 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 Allowedresponse.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 = Falsenow correctly match values containing slashes.The scheme and host of
base_urlare now normalized to lowercase so that requests to case-insensitive URL components are intercepted.Request forwarding preserves each cookie when multiple cookies share a name.
Forward the original
Cookieheader verbatim so valueless cookie tokens are preserved in forwarded requests.Forward the original
Cookieheader to Flask instead of re-parsing it, so requests with cookie names that the framework accepts butSimpleCookierejects no longer crash.Support iterable streaming request bodies with the
responsesandrequests-mockbackends.Custom HTTP reason phrases from Flask responses are now preserved for the
requests_mockback 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_urlwhose host matches the rule’s host.Internationalized
base_urlhost names are now normalized to their IDNA form so that internationalized routes are intercepted.Forwarded Flask responses are now closed so
call_on_closecallbacks 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.