diff --git a/juniper/src/http/graphiql.rs b/juniper/src/http/graphiql.rs index 803cf83ad..63a7882a4 100644 --- a/juniper/src/http/graphiql.rs +++ b/juniper/src/http/graphiql.rs @@ -12,25 +12,19 @@ pub fn graphiql_source( graphql_endpoint_url: &str, subscriptions_endpoint_url: Option<&str>, ) -> String { - let subscriptions_endpoint = if let Some(sub_url) = subscriptions_endpoint_url { - sub_url - } else { - "" - }; - include_str!("graphiql.html").replace( "", &format!( // language=JavaScript " - var JUNIPER_URL = '{graphql_url}'; - var JUNIPER_SUBSCRIPTIONS_URL = '{graphql_subscriptions_url}'; + var JUNIPER_URL = '{juniper_url}'; + var JUNIPER_SUBSCRIPTIONS_URL = '{juniper_subscriptions_url}'; {grahiql_js} ", - graphql_url = graphql_endpoint_url, - graphql_subscriptions_url = subscriptions_endpoint, + juniper_url = graphql_endpoint_url, + juniper_subscriptions_url = subscriptions_endpoint_url.unwrap_or_default(), grahiql_js = include_str!("graphiql.js"), ), ) diff --git a/juniper/src/types/scalars.rs b/juniper/src/types/scalars.rs index c904fcabf..960b3aeb5 100644 --- a/juniper/src/types/scalars.rs +++ b/juniper/src/types/scalars.rs @@ -1,4 +1,4 @@ -use std::{char, fmt, marker::PhantomData, ops::Deref, rc::Rc, thread::JoinHandle, u32}; +use std::{char, fmt, marker::PhantomData, ops::Deref, rc::Rc, thread::JoinHandle}; use serde::{Deserialize, Serialize};