Skip to content
The httpmock logo The httpmock logo

httpmock

Simple yet powerful HTTP mocking library for Rust

Mock HTTP Services

If you call HTTP services or APIs in your application, httpmock makes it easy to mock their responses in your tests.

Advanced Features

httpmock offers a range of advanced features, including record and playback, proxy mode, standalone mode, HTTPS support, sharing mocks, and many more.

Record and Playback

Record requests and responses when interacting with a real service and play them back in your tests.

Library and Standalone Server

httpmock is a Rust testing library, but it also includes a standalone server that runs in a separate process, such as a Docker container.

Useful Debugging Tools

One of the primary goals of httpmock is to be actually helpful by explaining the reasons when tests fail. It comes with useful logging, error messages, and an advanced request comparison algorithm.

Create and Share Mocks

httpmock allows you to create and share mocked responses using YAML-files.

Flexible Request Matching

Includes an extensive set of built-in matchers that let you define rules for matching requests based on method, path, headers, query parameters, body, and more, or use custom matchers for complex matching logic.