Skip to content

Commit

Permalink
Add test for query params parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealLorenz committed Dec 2, 2023
1 parent 1914f6f commit 987b6fd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions rq-core/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,18 @@ GET test.dev HTTP/1.0
let file = assert_parses(input);
assert_eq!(file.requests.len(), 2);
}

#[test]
fn test_query_params() {
let input = r#"
POST test.dev?foo=bar&baz=2 HTTP/1.0
authorization: token
"#;
let file = assert_parses(input);
assert_eq!(file.requests.len(), 1);
assert_eq!(file.requests[0].query.len(), 2);
assert_eq!(file.requests[0].query.get("foo").unwrap(), "bar");
assert_eq!(file.requests[0].query.get("baz").unwrap(), "2");
}
}

0 comments on commit 987b6fd

Please sign in to comment.