Respx

Latest version: v0.21.1

Safety actively analyzes 630305 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 8

0.16.0

One year since first release, yay!

Removed

- Dropped all deprecated APIs and models, see `0.15.0` Changed section. (PR 105)

Added

- Added support for content, data and json patterns. (PR 106)
- Automatic pattern registration when subclassing Pattern. (PR 108)

Fixed

- Multiple snapshots to support nested mock routers. (PR 107)

0.15.1

Added

- Snapshot routes and mocks when starting router, rollback when stopping. (PR 102)
- Added support for base_url combined with pattern lookups. (PR 103)
- Added support for patterns/lookups to the HTTP method helpers. (PR 104)

Fixed

- Fix to not clear routes added outside mock context when stopping router. (PR 102)

0.15.0

Added

- Added `respx.route(...)` with enhanced request pattern matching. (PR 96)
- Added support for AND/OR when request pattern matching. (PR 96)
- Added support for adding responses to a route using % operator. (PR 96)
- Added support for both `httpx.Response` and `MockResponse`. (PR 96)
- Enhanced Route (RequestPattern) with `.respond(...)` response details. (PR 96)
- Enhanced Route (RequestPattern) with `.pass_through()`. (PR 96)
- Add support for using route as side effect decorator. (PR 98)
- Add `headers` and `cookies` patterns. (PR 99)
- Add `contains` and `in` lookups. (PR 99)
- Introduced Route `.mock(...)` in favour of callbacks. (PR 101)
- Introduced Route `.return_value` and `.side_effect` setters. (PR 101)

Changed

- Deprecated mixing of request pattern and response details in all API's. (PR 96)
- Deprecated passing http method as arg in `respx.add` in favour of `method=`. (PR 96)
- Deprecated `alias=...` in favour of `name=...` when adding routes. (PR 96)
- Deprecated `respx.aliases` in favour of `respx.routes`. (PR 96)
- Deprecated `RequestPattern` in favour of `Route`. (PR 96)
- Deprecated `ResponseTemplate` in favour of `MockResponse`. (PR 96)
- Deprecated `pass_through=` in HTTP method API's (PR 96)
- Deprecated `response` arg in side effects (callbacks). (PR 97)
- Stacked responses are now recorded on same route calls. (PR 96)
- Pass-through routes no longer capture real response in call stats. (PR 97)
- Stacked responses no longer keeps and repeats last response. (PR 101)

Removed

- Removed support for regex `base_url`. (PR 96)
- Dropped support for `async` side effects (callbacks). (PR 97)
- Dropped support for mixing side effect (callback) and response details. (PR 97)

0.14.0

Added

- Added `text`, `html` and `json` content shorthands to ResponseTemplate. (PR 82)
- Added `text`, `html` and `json` content shorthands to high level API. (PR 93)
- Added support to set `http_version` for a mocked response. (PR 82)
- Added support for mocking by lowercase http methods, thanks lbillinghamtn. (PR 80)
- Added query `params` to align with HTTPX API, thanks jocke-l. (PR 81)
- Easier API to get request/response from call stats, thanks SlavaSkvortsov. (PR 85)
- Enhanced test to verify better content encoding by HTTPX. (PR 78)
- Added Python 3.9 to supported versions and test suite, thanks jairhenrique. (PR 89)

Changed

- `ResponseTemplate.content` as proper getter, i.e. no resolve/encode to bytes. (PR 82)
- Enhanced headers by using HTTPX Response when encoding raw responses. (PR 82)
- Deprecated `respx.stats` in favour of `respx.calls`, thanks SlavaSkvortsov. (PR 92)

Fixed

- Recorded requests in call stats are pre-read like the responses. (PR 86)
- Postponed request decoding for enhanced performance. (PR 91)
- Lazy call history for enhanced performance, thanks SlavaSkvortsov. (PR 92)

Removed

- Removed auto setting the `Content-Type: text/plain` header. (PR 82)

0.13.0

Fixed

- Fixed support for `HTTPX` 0.15. (PR 77)

Added

- Added global `respx.pop` api, thanks paulineribeyre. (PR 72)

Removed

- Dropped deprecated `HTTPXMock` in favour of `MockTransport`.
- Dropped deprecated `respx.request` in favour of `respx.add`.
- Removed `HTTPX` max version requirement in setup.py.

0.12.1

Fixed

- Fixed non-iterable pass-through responses. (PR 68)

Page 4 of 8

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.