Skip to content

Commit fe6d622

Browse files
authored
Update percent_encoding (#715)
Replaces #702
1 parent 4647a32 commit fe6d622

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

juniper_actix/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ thiserror = "1.0"
2626
juniper = { version = "0.14.2", path = "../juniper", features = ["expose-test-schema", "serde_json"] }
2727
env_logger = "0.7.1"
2828
log = "0.4.3"
29-
percent-encoding = "1.0"
3029
tokio = { version = "0.2", features = ["rt-core", "macros", "blocking"] }
3130
actix-cors = "0.2.0"
3231
actix-identity = "0.2.0"

juniper_warp/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ warp = "0.2"
2727
env_logger = "0.7.1"
2828
juniper = { version = "0.14.2", path = "../juniper", features = ["expose-test-schema", "serde_json"] }
2929
log = "0.4.3"
30-
percent-encoding = "1.0"
30+
percent-encoding = "2"
3131
tokio = { version = "0.2", features = ["blocking", "macros", "rt-core"] }
32+
url = "2"

juniper_warp/src/lib.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,9 +888,16 @@ mod tests_http_harness {
888888

889889
impl HttpIntegration for TestWarpIntegration {
890890
fn get(&self, url: &str) -> TestResponse {
891-
use percent_encoding::{utf8_percent_encode, QUERY_ENCODE_SET};
891+
use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS};
892+
use url::Url;
892893

893-
let url: String = utf8_percent_encode(&url.replace("/?", ""), QUERY_ENCODE_SET)
894+
/// https://url.spec.whatwg.org/#query-state
895+
const QUERY_ENCODE_SET: &AsciiSet =
896+
&CONTROLS.add(b' ').add(b'"').add(b'#').add(b'<').add(b'>');
897+
898+
let url = Url::parse(&format!("http://localhost:3000{}", url)).expect("url to parse");
899+
900+
let url: String = utf8_percent_encode(url.query().unwrap_or(""), QUERY_ENCODE_SET)
894901
.into_iter()
895902
.collect::<Vec<_>>()
896903
.join("");

0 commit comments

Comments
 (0)