mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-08 00:00:24 +02:00
JsonDeserializer extractor for zero-copy deserialization (#2431)
This commit is contained in:
+2
-2
@@ -12,12 +12,12 @@ use serde::{de::DeserializeOwned, Serialize};
|
||||
/// JSON Extractor / Response.
|
||||
///
|
||||
/// When used as an extractor, it can deserialize request bodies into some type that
|
||||
/// implements [`serde::Deserialize`]. The request will be rejected (and a [`JsonRejection`] will
|
||||
/// implements [`serde::de::DeserializeOwned`]. The request will be rejected (and a [`JsonRejection`] will
|
||||
/// be returned) if:
|
||||
///
|
||||
/// - The request doesn't have a `Content-Type: application/json` (or similar) header.
|
||||
/// - The body doesn't contain syntactically valid JSON.
|
||||
/// - The body contains syntactically valid JSON but it couldn't be deserialized into the target
|
||||
/// - The body contains syntactically valid JSON, but it couldn't be deserialized into the target
|
||||
/// type.
|
||||
/// - Buffering the request body fails.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user