Expand description
Sarcastic HTTP status code responses for testing and development.
Mirrors the behaviour of the @mockeroo/mock-responses npm package.
§Example
use mockeroo_mock_responses::{get_response, get_available_codes};
if let Some(resp) = get_response(404) {
println!("{} — {}", resp.status, resp.message);
}
let codes = get_available_codes();
println!("Supported codes: {:?}", codes);Structs§
- Response
- An HTTP status code paired with a randomly chosen sarcastic message.
Functions§
- get_
available_ codes - Returns all supported HTTP status codes in ascending order.
- get_
response - Returns a
Responsewith a random sarcastic message for the given HTTP status code, orNoneif the code is not recognised.