Skip to content

Commit

Permalink
Release juniper_rocket 0.8.2 backporting upgrade to rocket 0.5.0-…
Browse files Browse the repository at this point in the history
…rc.2
  • Loading branch information
tyranron committed May 25, 2022
1 parent 1cb305c commit e823452
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
4 changes: 4 additions & 0 deletions juniper_rocket/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

- Compatibility with the latest `juniper`.

# [[0.8.2] 2022-05-25](https://github.com/graphql-rust/juniper/releases/tag/juniper_rocket-v0.8.2)

- `rocket` version is now `0.5.0-rc.2`.

# [[0.8.1] 2022-03-29](https://github.com/graphql-rust/juniper/releases/tag/juniper_rocket-v0.8.1)

- Ability to set custom request body size limit ([#1044](https://github.com/graphql-rust/juniper/pull/1044)).
Expand Down
4 changes: 2 additions & 2 deletions juniper_rocket/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "juniper_rocket"
version = "0.8.1"
version = "0.8.2"
edition = "2018"
authors = [
"Magnus Hallin <[email protected]>",
Expand All @@ -14,7 +14,7 @@ repository = "https://github.com/graphql-rust/juniper"
[dependencies]
futures = "0.3.1"
juniper = { version = "0.15.7", path = "../juniper", default-features = false }
rocket = { version = "0.5.0-rc.1", default-features = false }
rocket = { version = "=0.5.0-rc.2", default-features = false }
serde_json = "1.0.2"

[dev-dependencies]
Expand Down
6 changes: 3 additions & 3 deletions juniper_rocket/examples/rocket_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use juniper::{
tests::fixtures::starwars::schema::{Database, Query},
EmptyMutation, EmptySubscription, RootNode,
};
use rocket::{response::content, Rocket, State};
use rocket::{response::content, State};

type Schema = RootNode<'static, Query, EmptyMutation<Database>, EmptySubscription<Database>>;

#[rocket::get("/")]
fn graphiql() -> content::Html<String> {
fn graphiql() -> content::RawHtml<String> {
juniper_rocket::graphiql_source("/graphql", None)
}

Expand All @@ -31,7 +31,7 @@ fn post_graphql_handler(

#[rocket::main]
async fn main() {
Rocket::build()
let _ = rocket::build()
.manage(Database::new())
.manage(Schema::new(
Query,
Expand Down
15 changes: 9 additions & 6 deletions juniper_rocket/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Check the LICENSE file for details.
*/

#![doc(html_root_url = "https://docs.rs/juniper_rocket/0.7.1")]
#![doc(html_root_url = "https://docs.rs/juniper_rocket/0.8.2")]

use std::{borrow::Cow, io::Cursor};

Expand Down Expand Up @@ -72,8 +72,8 @@ pub struct GraphQLResponse(pub Status, pub String);
pub fn graphiql_source(
graphql_endpoint_url: &str,
subscriptions_endpoint_url: Option<&str>,
) -> content::Html<String> {
content::Html(juniper::http::graphiql::graphiql_source(
) -> content::RawHtml<String> {
content::RawHtml(juniper::http::graphiql::graphiql_source(
graphql_endpoint_url,
subscriptions_endpoint_url,
))
Expand All @@ -83,8 +83,8 @@ pub fn graphiql_source(
pub fn playground_source(
graphql_endpoint_url: &str,
subscriptions_endpoint_url: Option<&str>,
) -> content::Html<String> {
content::Html(juniper::http::playground::playground_source(
) -> content::RawHtml<String> {
content::RawHtml(juniper::http::playground::playground_source(
graphql_endpoint_url,
subscriptions_endpoint_url,
))
Expand Down Expand Up @@ -337,7 +337,10 @@ where
};

Box::pin(async move {
let limit = req.limits().get("graphql").unwrap_or(BODY_LIMIT.bytes());
let limit = req
.limits()
.get("graphql")
.unwrap_or_else(|| BODY_LIMIT.bytes());
let mut reader = data.open(limit);
let mut body = String::new();
if let Err(e) = reader.read_to_string(&mut body).await {
Expand Down

0 comments on commit e823452

Please sign in to comment.