From 987b6fd541d23ba610c5da0ebf88d5fcc1299c43 Mon Sep 17 00:00:00 2001 From: TheRealLorenz Date: Sat, 2 Dec 2023 12:24:46 +0100 Subject: [PATCH] Add test for query params parsing --- rq-core/src/parser.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rq-core/src/parser.rs b/rq-core/src/parser.rs index f6f43ca..2d2d2c6 100644 --- a/rq-core/src/parser.rs +++ b/rq-core/src/parser.rs @@ -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"); + } }