1
0
mirror of https://github.com/actix/examples synced 2025-06-28 18:00:37 +02:00

Fix examples of diesel and json (#207)

This commit is contained in:
Yuki Okushi
2019-12-11 11:33:12 +09:00
committed by GitHub
parent 998f92d2e3
commit 5ffbaacdce
3 changed files with 10 additions and 8 deletions

View File

@ -60,8 +60,7 @@ async fn add(
/// This handler manually parse json object. Bytes object supports FromRequest trait (extractor)
/// and could be loaded from request payload automatically
async fn index_add(body: Bytes, pool: web::Data<Pool>) -> Result<HttpResponse, Error> {
let mut body = BytesMut::new();
async fn index_add(body: web::Bytes, pool: web::Data<Pool>) -> Result<HttpResponse, Error> {
// body is loaded, now we can deserialize id with serde-json
let r_obj = serde_json::from_slice::<MyUser>(&body);