Move graphiql export location (#615)

This fixes a TODO.
This commit is contained in:
Christian Legnitto 2020-04-10 00:06:39 -10:00 committed by GitHub
parent 2618100140
commit 5f454e05c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 7 deletions

View file

@ -22,6 +22,8 @@ See [#569](https://github.com/graphql-rust/juniper/pull/569).
## Breaking Changes
- `juniper::graphiql` has moved to `juniper::http::graphiql`
- remove old `graphql_object!` macro, rename `object` proc macro to `graphql_object`
- Remove deprecated `ScalarValue` custom derive (renamed to GraphQLScalarValue)

View file

@ -142,8 +142,6 @@ mod validation;
// https://github.com/rust-lang/cargo/issues/1520
pub mod http;
pub mod integrations;
// TODO: remove this alias export in 0.10. (breaking change)
pub use crate::http::graphiql;
#[cfg(all(test, not(feature = "expose-test-schema")))]
mod tests;

View file

@ -117,7 +117,7 @@ async fn parse_post_req<S: ScalarValue>(
pub async fn graphiql(graphql_endpoint: &str) -> Result<Response<Body>, hyper::Error> {
let mut resp = new_html_response(StatusCode::OK);
// XXX: is the call to graphiql_source blocking?
*resp.body_mut() = Body::from(juniper::graphiql::graphiql_source(graphql_endpoint));
*resp.body_mut() = Body::from(juniper::http::graphiql::graphiql_source(graphql_endpoint));
Ok(resp)
}

View file

@ -326,7 +326,7 @@ impl Handler for GraphiQLHandler {
Ok(Response::with((
content_type,
status::Ok,
juniper::graphiql::graphiql_source(&self.graphql_url),
juniper::http::graphiql::graphiql_source(&self.graphql_url),
)))
}
}

View file

@ -72,7 +72,9 @@ pub struct GraphQLResponse(pub Status, pub String);
/// Generate an HTML page containing GraphiQL
pub fn graphiql_source(graphql_endpoint_url: &str) -> content::Html<String> {
content::Html(juniper::graphiql::graphiql_source(graphql_endpoint_url))
content::Html(juniper::http::graphiql::graphiql_source(
graphql_endpoint_url,
))
}
/// Generate an HTML page containing GraphQL Playground

View file

@ -72,7 +72,9 @@ pub struct GraphQLResponse(pub Status, pub String);
/// Generate an HTML page containing GraphiQL
pub fn graphiql_source(graphql_endpoint_url: &str) -> content::Html<String> {
content::Html(juniper::graphiql::graphiql_source(graphql_endpoint_url))
content::Html(juniper::http::graphiql::graphiql_source(
graphql_endpoint_url,
))
}
/// Generate an HTML page containing GraphQL Playground

View file

@ -312,7 +312,7 @@ pub fn graphiql_filter(
fn graphiql_response(graphql_endpoint_url: &'static str) -> warp::http::Response<Vec<u8>> {
warp::http::Response::builder()
.header("content-type", "text/html;charset=utf-8")
.body(juniper::graphiql::graphiql_source(graphql_endpoint_url).into_bytes())
.body(juniper::http::graphiql::graphiql_source(graphql_endpoint_url).into_bytes())
.expect("response is valid")
}