Skip to content

Commit

Permalink
Add test to match any query
Browse files Browse the repository at this point in the history
  • Loading branch information
lipanski committed Mar 30, 2023
1 parent b747576 commit 6b7621e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1684,6 +1684,22 @@ fn test_match_missing_query() {
assert_eq!("HTTP/1.1 501 Not Implemented\r\n", status_line);
}

#[test]
fn test_match_any_query() {
let mut s = Server::new();
let host = s.host_with_port();
s.mock("GET", "/hello").match_query(Matcher::Any).create();

let (status_line, _, _) = request(&host, "GET /hello", "");
assert_eq!("HTTP/1.1 200 OK\r\n", status_line);

let (status_line, _, _) = request(&host, "GET /hello?", "");
assert_eq!("HTTP/1.1 200 OK\r\n", status_line);

let (status_line, _, _) = request(&host, "GET /hello?number=one", "");
assert_eq!("HTTP/1.1 200 OK\r\n", status_line);
}

#[test]
fn test_anyof_exact_path_and_query_matcher() {
let mut s = Server::new();
Expand Down

0 comments on commit 6b7621e

Please sign in to comment.