Backport making request body size Limit
configurable in juniper_rocket
(#1044)
Co-authored-by: Filip Gospodinov <f@gospodinov.ch>
This commit is contained in:
parent
fe9c89c73c
commit
1cb305cc1a
3 changed files with 8 additions and 3 deletions
|
@ -2,7 +2,11 @@
|
||||||
|
|
||||||
- Compatibility with the latest `juniper`.
|
- 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).
|
- Require async rocket support (`rocket` >= 0.5-rc1).
|
||||||
- Compatibility with the latest `juniper`.
|
- Compatibility with the latest `juniper`.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "juniper_rocket"
|
name = "juniper_rocket"
|
||||||
version = "0.8.0"
|
version = "0.8.1"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
authors = [
|
authors = [
|
||||||
"Magnus Hallin <mhallin@fastmail.com>",
|
"Magnus Hallin <mhallin@fastmail.com>",
|
||||||
|
|
|
@ -337,8 +337,9 @@ where
|
||||||
};
|
};
|
||||||
|
|
||||||
Box::pin(async move {
|
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 body = String::new();
|
||||||
let mut reader = data.open(BODY_LIMIT.bytes());
|
|
||||||
if let Err(e) = reader.read_to_string(&mut body).await {
|
if let Err(e) = reader.read_to_string(&mut body).await {
|
||||||
return Failure((Status::InternalServerError, format!("{:?}", e)));
|
return Failure((Status::InternalServerError, format!("{:?}", e)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue