mirror of https://github.com/fafhrd91/actix-web
add responder for unit
This commit is contained in:
parent
a3806cde19
commit
0c4b8e138c
|
@ -3,6 +3,7 @@
|
||||||
## Unreleased - 2021-xx-xx
|
## Unreleased - 2021-xx-xx
|
||||||
### Added
|
### Added
|
||||||
* Option to allow `Json` extractor to work without a `Content-Type` header present. [#2362]
|
* Option to allow `Json` extractor to work without a `Content-Type` header present. [#2362]
|
||||||
|
* Implemented responder for `()` to respond with `204 No Content`
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Associated type `FromRequest::Config` was removed. [#2233]
|
* Associated type `FromRequest::Config` was removed. [#2233]
|
||||||
|
|
|
@ -116,6 +116,12 @@ impl<T: Responder> Responder for (T, StatusCode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Responder for () {
|
||||||
|
fn respond_to(self, req: &HttpRequest) -> HttpResponse {
|
||||||
|
HttpResponse::new(StatusCode::NO_CONTENT)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! impl_responder {
|
macro_rules! impl_responder {
|
||||||
($res: ty, $ct: path) => {
|
($res: ty, $ct: path) => {
|
||||||
impl Responder for $res {
|
impl Responder for $res {
|
||||||
|
|
Loading…
Reference in New Issue