Backport making request body size Limit configurable in juniper_rocket (#1044)

Co-authored-by: Filip Gospodinov <f@gospodinov.ch>
This commit is contained in:
tyranron 2022-03-29 13:26:58 +03:00
parent fe9c89c73c
commit 1cb305cc1a
No known key found for this signature in database
GPG key ID: 762E144FB230A4F0
3 changed files with 8 additions and 3 deletions

View file

@ -2,7 +2,11 @@
- Compatibility with the latest `juniper`.
# [[0.8.0] 2021-07-08](https://github.com/graphql-rust/juniper/releases/tag/juniper_rocket-0.8.0)
# [[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)).
# [[0.8.0] 2021-07-08](https://github.com/graphql-rust/juniper/releases/tag/juniper_rocket-v0.8.0)
- Require async rocket support (`rocket` >= 0.5-rc1).
- Compatibility with the latest `juniper`.

View file

@ -1,6 +1,6 @@
[package]
name = "juniper_rocket"
version = "0.8.0"
version = "0.8.1"
edition = "2018"
authors = [
"Magnus Hallin <mhallin@fastmail.com>",

View file

@ -337,8 +337,9 @@ where
};
Box::pin(async move {
let limit = req.limits().get("graphql").unwrap_or(BODY_LIMIT.bytes());
let mut reader = data.open(limit);
let mut body = String::new();
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)));
}