Release juniper_rocket 0.8.2 backporting upgrade to rocket 0.5.0-rc.2

This commit is contained in:
tyranron 2022-05-25 11:11:28 +02:00
parent 1cb305cc1a
commit e82345243c
No known key found for this signature in database
GPG key ID: 762E144FB230A4F0
4 changed files with 18 additions and 11 deletions

View file

@ -2,6 +2,10 @@
- Compatibility with the latest `juniper`. - 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) # [[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)). - Ability to set custom request body size limit ([#1044](https://github.com/graphql-rust/juniper/pull/1044)).

View file

@ -1,6 +1,6 @@
[package] [package]
name = "juniper_rocket" name = "juniper_rocket"
version = "0.8.1" version = "0.8.2"
edition = "2018" edition = "2018"
authors = [ authors = [
"Magnus Hallin <mhallin@fastmail.com>", "Magnus Hallin <mhallin@fastmail.com>",
@ -14,7 +14,7 @@ repository = "https://github.com/graphql-rust/juniper"
[dependencies] [dependencies]
futures = "0.3.1" futures = "0.3.1"
juniper = { version = "0.15.7", path = "../juniper", default-features = false } 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" serde_json = "1.0.2"
[dev-dependencies] [dev-dependencies]

View file

@ -2,12 +2,12 @@ use juniper::{
tests::fixtures::starwars::schema::{Database, Query}, tests::fixtures::starwars::schema::{Database, Query},
EmptyMutation, EmptySubscription, RootNode, EmptyMutation, EmptySubscription, RootNode,
}; };
use rocket::{response::content, Rocket, State}; use rocket::{response::content, State};
type Schema = RootNode<'static, Query, EmptyMutation<Database>, EmptySubscription<Database>>; type Schema = RootNode<'static, Query, EmptyMutation<Database>, EmptySubscription<Database>>;
#[rocket::get("/")] #[rocket::get("/")]
fn graphiql() -> content::Html<String> { fn graphiql() -> content::RawHtml<String> {
juniper_rocket::graphiql_source("/graphql", None) juniper_rocket::graphiql_source("/graphql", None)
} }
@ -31,7 +31,7 @@ fn post_graphql_handler(
#[rocket::main] #[rocket::main]
async fn main() { async fn main() {
Rocket::build() let _ = rocket::build()
.manage(Database::new()) .manage(Database::new())
.manage(Schema::new( .manage(Schema::new(
Query, Query,

View file

@ -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}; use std::{borrow::Cow, io::Cursor};
@ -72,8 +72,8 @@ pub struct GraphQLResponse(pub Status, pub String);
pub fn graphiql_source( pub fn graphiql_source(
graphql_endpoint_url: &str, graphql_endpoint_url: &str,
subscriptions_endpoint_url: Option<&str>, subscriptions_endpoint_url: Option<&str>,
) -> content::Html<String> { ) -> content::RawHtml<String> {
content::Html(juniper::http::graphiql::graphiql_source( content::RawHtml(juniper::http::graphiql::graphiql_source(
graphql_endpoint_url, graphql_endpoint_url,
subscriptions_endpoint_url, subscriptions_endpoint_url,
)) ))
@ -83,8 +83,8 @@ pub fn graphiql_source(
pub fn playground_source( pub fn playground_source(
graphql_endpoint_url: &str, graphql_endpoint_url: &str,
subscriptions_endpoint_url: Option<&str>, subscriptions_endpoint_url: Option<&str>,
) -> content::Html<String> { ) -> content::RawHtml<String> {
content::Html(juniper::http::playground::playground_source( content::RawHtml(juniper::http::playground::playground_source(
graphql_endpoint_url, graphql_endpoint_url,
subscriptions_endpoint_url, subscriptions_endpoint_url,
)) ))
@ -337,7 +337,10 @@ where
}; };
Box::pin(async move { 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 reader = data.open(limit);
let mut body = String::new(); let mut body = String::new();
if let Err(e) = reader.read_to_string(&mut body).await { if let Err(e) = reader.read_to_string(&mut body).await {