{"id":57751,"library":"httpmock","title":"HttpMock","description":"HTTP mocking library for Rust that allows you to simulate HTTP servers and test HTTP clients.","status":"active","version":"0.8.3","language":"rust","source_language":null,"source_url":"https://github.com/httpmock/httpmock","tags":["http","mocking","testing","server"],"install":[{"cmd":"# Cargo.toml\n[dependencies]\nhttpmock = \"0.8.3\"","lang":"toml","label":"Cargo.toml"},{"cmd":"cargo add httpmock","lang":"bash","label":"cargo add"}],"dependencies":[],"imports":[{"symbol":"MockServer","correct":"use httpmock::MockServer;"}],"quickstart":{"code":"use httpmock::MockServer;\n\nlet server = MockServer::start();\nlet mock = server.mock(|when, then| {\n    when.method(\"GET\").path(\"/hello\");\n    then.status(200).body(\"world\");\n});\n\nlet response = reqwest::get(&server.url(\"/hello\")).unwrap();\nassert_eq!(response.text().unwrap(), \"world\");\nmock.assert();","lang":"rust","description":"Creates a mock HTTP server, defines a mock endpoint, and asserts the request was made."},"warnings":[{"fix":"Always use server.url() or server.base_url() to construct request URLs.","message":"MockServer runs on a random port; ensure your client uses the correct URL from server.url()","severity":"gotcha","affected_versions":">=0.6.0"}],"env_vars":null,"search_vec":"'allow':8 'client':17 'http':2,12,16,18 'httpmock':1 'librari':4 'mock':3,19 'rust':6 'server':13,21 'simul':11 'test':15,20","created_at":"2026-06-16T15:56:14.420435+00:00","updated_at":"2026-06-16T15:56:14.420435+00:00","problems":[],"ecosystem":"crates","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/httpmock/httpmock","github":"https://github.com/httpmock/httpmock","docs":"https://docs.rs/httpmock/","changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","http-client"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-16","next_check":"2026-12-13","install_tag":null}}