From 02fd164e96d36e48e4dbfea7a360ef6fd4337d34 Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Sun, 29 Sep 2019 18:47:37 -0700 Subject: [PATCH] Update `url` dependency (#432) --- juniper/CHANGELOG.md | 1 + juniper/Cargo.toml | 2 +- juniper_hyper/Cargo.toml | 2 +- juniper_hyper/examples/hyper_server.rs | 2 +- juniper_iron/Cargo.toml | 3 ++- juniper_iron/src/lib.rs | 9 ++++++--- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/juniper/CHANGELOG.md b/juniper/CHANGELOG.md index 31f9c44a..c24b1c0b 100644 --- a/juniper/CHANGELOG.md +++ b/juniper/CHANGELOG.md @@ -1,5 +1,6 @@ # master +- Require `url` 2.x if `url` feature is enabled. - Improve lookahead visitability. - Add ability to parse 'subscription'. diff --git a/juniper/Cargo.toml b/juniper/Cargo.toml index a72c7d7a..a581977e 100644 --- a/juniper/Cargo.toml +++ b/juniper/Cargo.toml @@ -41,7 +41,7 @@ serde_derive = { version = "1.0.2" } chrono = { version = "0.4.0", optional = true } serde_json = { version="1.0.2", optional = true } -url = { version = "1.5.1", optional = true } +url = { version = "2", optional = true } uuid = { version = "0.7", optional = true } [dev-dependencies] diff --git a/juniper_hyper/Cargo.toml b/juniper_hyper/Cargo.toml index eecc445a..4017ee51 100644 --- a/juniper_hyper/Cargo.toml +++ b/juniper_hyper/Cargo.toml @@ -12,7 +12,7 @@ edition = "2018" serde = "1.0" serde_json = "1.0" serde_derive = "1.0" -url = "1.7" +url = "2" juniper = { version = "0.13.1" , default-features = false, path = "../juniper"} futures = "0.1" diff --git a/juniper_hyper/examples/hyper_server.rs b/juniper_hyper/examples/hyper_server.rs index 208f8e1b..802131e5 100644 --- a/juniper_hyper/examples/hyper_server.rs +++ b/juniper_hyper/examples/hyper_server.rs @@ -27,7 +27,7 @@ fn main() { let new_service = move || { let root_node = root_node.clone(); let ctx = db.clone(); - service_fn(move |req| -> Box + Send> { + service_fn(move |req| -> Box + Send> { let root_node = root_node.clone(); let ctx = ctx.clone(); match (req.method(), req.uri().path()) { diff --git a/juniper_iron/Cargo.toml b/juniper_iron/Cargo.toml index 510537f7..f6ac6661 100644 --- a/juniper_iron/Cargo.toml +++ b/juniper_iron/Cargo.toml @@ -25,7 +25,8 @@ iron-test = "0.6" router = "0.6" mount = "0.4" logger = "0.4" -url = "1.7.1" +url = "2" +percent-encoding = "2" [dev-dependencies.juniper] version = "0.13.1" diff --git a/juniper_iron/src/lib.rs b/juniper_iron/src/lib.rs index 20215fbb..678226fe 100644 --- a/juniper_iron/src/lib.rs +++ b/juniper_iron/src/lib.rs @@ -431,7 +431,7 @@ mod tests { use super::*; use iron::{Handler, Headers, Url}; use iron_test::{request, response}; - use url::percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET}; + use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS}; use juniper::{ http::tests as http_tests, @@ -441,6 +441,9 @@ mod tests { use super::GraphQLHandler; + /// https://url.spec.whatwg.org/#query-state + const QUERY_ENCODE_SET: &AsciiSet = &CONTROLS.add(b' ').add(b'"').add(b'#').add(b'<').add(b'>'); + // This is ugly but it works. `iron_test` just dumps the path/url in headers // and newer `hyper` doesn't allow unescaped "{" or "}". fn fixup_url(url: &str) -> String { @@ -454,7 +457,7 @@ mod tests { format!( "http://localhost:3000{}?{}", path, - utf8_percent_encode(url.query().unwrap_or(""), DEFAULT_ENCODE_SET) + utf8_percent_encode(url.query().unwrap_or(""), QUERY_ENCODE_SET) ) } @@ -521,7 +524,7 @@ mod tests { } } - fn make_handler() -> Box { + fn make_handler() -> Box { Box::new(GraphQLHandler::new( context_factory, Query,