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:
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user