Skip to content

Commit

Permalink
Update docs on the path matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
lipanski committed Mar 30, 2023
1 parent 6b7621e commit 1276b06
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,20 @@
//! JSON), any or missing. The following guide will walk you through the most common matchers. Check the
//! `Matcher` documentation for all the rest.
//!
//! # Matching by path
//! # Matching by path and query
//!
//! By default, the request path is compared by its exact value:
//! By default, the request path and query is compared by its exact value:
//!
//! ## Example
//!
//! ```
//! let mut s = mockito::Server::new();
//!
//! // Matched only calls to GET /hello
//! // Matches only calls to GET /hello
//! s.mock("GET", "/hello").create();
//!
//! // Matches only calls to GET /hello?world=1
//! s.mock("GET", "/hello?world=1").create();
//! ```
//!
//! You can also match the path partially, by using a regular expression:
Expand Down Expand Up @@ -252,6 +255,17 @@
//! s.mock("GET", "/test?hello=world").create();
//! ```
//!
//! If you'd like to ignore the query entirely, use the `Matcher::Any` variant:
//!
//! ## Example
//!
//! ```
//! let mut s = mockito::Server::new();
//!
//! // This will match requests to GET /test with any query
//! s.mock("GET", "/test").match_query(mockito::Matcher::Any).create();
//! ```
//!
//! # Matching by header
//!
//! By default, headers are compared by their exact value. The header name letter case is ignored though.
Expand Down

0 comments on commit 1276b06

Please sign in to comment.