mirror of
https://github.com/tokio-rs/axum.git
synced 2025-01-18 23:23:30 +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.
|
/// JSON Extractor / Response.
|
||||||
///
|
///
|
||||||
/// When used as an extractor, it can deserialize request bodies into some type that
|
/// 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
|
/// implements [`serde::Deserialize`]. The request will be rejected (and a [`JsonRejection`] will
|
||||||
/// the `Content-Type: application/json` header, it will reject the request and return a
|
/// be returned) if:
|
||||||
/// `400 Bad Request` response.
|
///
|
||||||
|
/// - 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
|
/// # Extractor example
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue