From bdc8745a5624072ebf62ba302efd56452c9bbcc9 Mon Sep 17 00:00:00 2001 From: Dmitry Murzin Date: Mon, 10 Aug 2020 01:46:52 +0500 Subject: [PATCH] Fix compilation of juniper_rocket_async: add limit to Data::open() call (#733) --- juniper_iron/src/lib.rs | 2 +- juniper_rocket_async/src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/juniper_iron/src/lib.rs b/juniper_iron/src/lib.rs index 9bcb8634..82077d62 100644 --- a/juniper_iron/src/lib.rs +++ b/juniper_iron/src/lib.rs @@ -47,7 +47,7 @@ use juniper::{Context, EmptyMutation, EmptySubscription}; # Ok(&self.name) # } # -# fn friends(context: &Database) -> FieldResult> { +# fn friends(&self, context: &Database) -> FieldResult> { # Ok(self.friend_ids.iter() # .filter_map(|id| executor.context().users.get(id)) # .collect()) diff --git a/juniper_rocket_async/src/lib.rs b/juniper_rocket_async/src/lib.rs index ace26ce6..84168a35 100644 --- a/juniper_rocket_async/src/lib.rs +++ b/juniper_rocket_async/src/lib.rs @@ -41,7 +41,7 @@ Check the LICENSE file for details. use std::io::Cursor; use rocket::{ - data::{self, FromData}, + data::{self, FromData, ToByteUnit}, http::{ContentType, RawStr, Status}, outcome::Outcome::{Failure, Forward, Success}, request::{FormItems, FromForm, FromFormValue}, @@ -305,7 +305,7 @@ where Box::pin(async move { let mut body = String::new(); - let mut reader = data.open().take(BODY_LIMIT); + let mut reader = data.open(BODY_LIMIT.bytes()); if let Err(e) = reader.read_to_string(&mut body).await { return Failure((Status::InternalServerError, format!("{:?}", e))); }