Skip to content

# Mock HTTPX

RESPX is a mock router, capturing requests sent by `HTTPX`, mocking their responses.

Inspired by the flexible query API of the Django ORM, requests are filtered and matched against routes and their request patterns and lookups.

Request patterns are bits of the request, like `host` `method` `path` etc, with given lookup values, combined using bitwise operators to form a `Route`, i.e. `respx.route(path__regex=...)`

A captured request, matching a `Route`, resolves to a mocked `httpx.Response`, or triggers a given side effect. To skip mocking a specific request, a route can be marked to pass through.

> Read the User Guide for a complete walk-through.