.await? result from read_to_string()
This commit is contained in:
parent
8aa99cea35
commit
65b2c38c29
@ -9,7 +9,6 @@ use plume_models::{
|
|||||||
use rocket::{data::*, http::Status, response::status, Outcome::*, Request};
|
use rocket::{data::*, http::Status, response::status, Outcome::*, Request};
|
||||||
use rocket_contrib::json::*;
|
use rocket_contrib::json::*;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::io::Read;
|
|
||||||
use tokio::io::AsyncReadExt;
|
use tokio::io::AsyncReadExt;
|
||||||
|
|
||||||
pub fn handle_incoming(
|
pub fn handle_incoming(
|
||||||
@ -78,7 +77,7 @@ impl<'a, T: Deserialize<'a>> FromData<'a> for SignedJson<T> {
|
|||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let size_limit = r.limits().get("json").unwrap_or(JSON_LIMIT);
|
let size_limit = r.limits().get("json").unwrap_or(JSON_LIMIT);
|
||||||
let mut s = String::with_capacity(512);
|
let mut s = String::with_capacity(512);
|
||||||
let outcome = match d.open().take(size_limit).read_to_string(&mut s) {
|
let outcome = match d.open().take(size_limit).read_to_string(&mut s).await {
|
||||||
Ok(_) => Success(s),
|
Ok(_) => Success(s),
|
||||||
Err(e) => Failure((Status::BadRequest, JsonError::Io(e))),
|
Err(e) => Failure((Status::BadRequest, JsonError::Io(e))),
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user