mirror of
https://github.com/tokio-rs/axum.git
synced 2025-01-01 00:50:32 +01:00
Fix out of date docs for Json
(#871)
Fixes https://github.com/tokio-rs/axum/issues/865
This commit is contained in:
parent
437fe5b931
commit
2c985246ba
1 changed files with 10 additions and 3 deletions
|
@ -15,9 +15,16 @@ use std::ops::{Deref, DerefMut};
|
|||
/// JSON Extractor / Response.
|
||||
///
|
||||
/// When used as an extractor, it can deserialize request bodies into some type that
|
||||
/// implements [`serde::Deserialize`]. If the request body cannot be parsed, or it does not contain
|
||||
/// the `Content-Type: application/json` header, it will reject the request and return a
|
||||
/// `400 Bad Request` response.
|
||||
/// implements [`serde::Deserialize`]. 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
|
||||
/// type.
|
||||
/// - Buffering the request body fails.
|
||||
///
|
||||
/// See [`JsonRejection`] for more details.
|
||||
///
|
||||
/// # Extractor example
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue