Fix compilation of juniper_rocket_async: add limit to Data::open() call (#733)

This commit is contained in:
Dmitry Murzin 2020-08-10 01:46:52 +05:00 committed by GitHub
parent 54e0e208fc
commit bdc8745a56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -47,7 +47,7 @@ use juniper::{Context, EmptyMutation, EmptySubscription};
# Ok(&self.name)
# }
#
# fn friends(context: &Database) -> FieldResult<Vec<&User>> {
# fn friends(&self, context: &Database) -> FieldResult<Vec<&User>> {
# Ok(self.friend_ids.iter()
# .filter_map(|id| executor.context().users.get(id))
# .collect())

View file

@ -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)));
}