mockito icon indicating copy to clipboard operation
mockito copied to clipboard

HTTP mocking for Rust!

Results 22 mockito issues
Sort by recently updated
recently updated
newest added

```rust use core::time::Duration; use reqwest::header::USER_AGENT; let _m = mock("GET", "/hello") .with_status(200) .with_header("content-type", "text/plain") .with_body("Hello World") .create(); let host = mockito::server_url(); let timeout = Duration::from_millis(3_000); let client = reqwest::blocking::Client::new(); let req...

- Rust version: 1.58.1 - Mockito version: 0.30.0 When using mockito's `matchbody` method to match requests, when a request is received that is not a good match, a `serde::json::error::Error` is...

Hello, I'm testing a client that makes a HTTP 1.0 request. When making the HTTP 1.0 request to mockito it hangs. ``` use reqwest::{Client, Version, Response}; async fn request_with_version(url: &str,...

bug

I observed an issue where one of my tests using this library failed sporadically with > Expected 2 request(s) to: GET /path ...but received 3 The mock in this test...

I'm testing an application which has support for falling back to other endpoints. Because the server is known the API url never changes and isn't configurable. I want to test...

Right now, any user of the API has to remember to call [`Mock::assert`](https://docs.rs/mockito/0.28.0/mockito/struct.Mock.html#method.assert) at the end of each and every test. If they forget, the mock doesn't actually test anything....

support read request info in `body_fn`, then we can create different responses based on request info ```rs mock("GET", Matcher::Regex("/hello/.*".to_string())) .with_body_from_fn(|request_info, write| { let word = extract_word(request_info.path); write!(write, "hello {}", word)...

I had one test which setup a few mocks. I then started writing a second test which used some of the same endpoints When I ran the tests, I expected...

To support more complex validation I would like the ability to use a closure (probably `Fn`) as a matcher.

I have an HTTP client library that I test with mockito. One of the recent additions is support for trusting custom TLS root certificates, and it would be nice to...