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:
Jonas Platte
2021-10-02 15:46:33 +02:00
committed by GitHub
parent cc4ae6b297
commit 250ea0cfef
7 changed files with 28 additions and 8 deletions
+3 -2
View File
@@ -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]