mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-23 00:00:15 +02:00
Make JSON and HTTP1 support optional (#286)
* Make json support an optional feature * Fix Json type documentation * Make hyper's http1 feature optional
This commit is contained in:
+3
-2
@@ -17,10 +17,10 @@ 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
|
||||
/// implements [`serde::Serialize`]. If the request body cannot be parsed, or it does not contain
|
||||
/// 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.
|
||||
///
|
||||
@@ -87,6 +87,7 @@ use std::{
|
||||
/// # };
|
||||
/// ```
|
||||
#[derive(Debug, Clone, Copy, Default)]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "json")))]
|
||||
pub struct Json<T>(pub T);
|
||||
|
||||
#[async_trait]
|
||||
|
||||
Reference in New Issue
Block a user