Remove qstring dependency. (#221)

Instead, rely on Url's built-in query parameter handling. A Request now
accumulates a list of query param pairs, and joins them with a parsed
URL at the time do_call is called.

In the process, remove some getters that rely on parsing the URL.
Adapting these getters was going to be awkward, and they mostly
duplicate things people can readily get by parsing the URL.
This commit is contained in:
Jacob Hoffman-Andrews authored and GitHub committed 2020-11-13 00:02:52 -08:00
1 parent 920eccf37a
commit a0b901f35b
5 files changed
+29 -151

No files matched your search

+6 -2
View File
@@ -25,7 +25,11 @@ fn escaped_query_string() {
.unwrap();
let vec = resp.to_write_vec();
let s = String::from_utf8_lossy(&vec);
assert!(s.contains("GET /escaped_query_string?foo=bar&baz=yo%20lo HTTP/1.1"))
assert!(
s.contains("GET /escaped_query_string?foo=bar&baz=yo+lo HTTP/1.1"),
"req: {}",
s
);
}
#[test]
@@ -50,5 +54,5 @@ fn query_in_path_and_req() {
.unwrap();
let vec = resp.to_write_vec();
let s = String::from_utf8_lossy(&vec);
assert!(s.contains("GET /query_in_path_and_req?foo=bar&baz=1%202%203 HTTP/1.1"))
assert!(s.contains("GET /query_in_path_and_req?foo=bar&baz=1+2+3 HTTP/1.1"))
}
+2 -2
View File
@@ -136,7 +136,7 @@ fn request_debug() {
assert_eq!(
s,
"Request(GET /my/page, [Authorization: abcdef, \
"Request(GET http://localhost/my/page [], [Authorization: abcdef, \
Content-Length: 1234, Content-Type: application/json])"
);
@@ -148,7 +148,7 @@ fn request_debug() {
assert_eq!(
s,
"Request(GET /my/page?q=z&foo=bar%20baz, [Authorization: abcdef])"
"Request(GET http://localhost/my/page?q=z [(\"foo\", \"bar baz\")], [Authorization: abcdef])"
);
}