diff --git a/src/response/into_response.rs b/src/response/into_response.rs index 35f734867..6763d8853 100644 --- a/src/response/into_response.rs +++ b/src/response/into_response.rs @@ -105,3 +105,16 @@ impl IntoResponse for WithStatus { self.inner.into_response().set_status(self.status) } } + +impl IntoResponse for Result +where + T: IntoResponse, + E: IntoResponse, +{ + fn into_response(self) -> Response { + match self { + Ok(t) => t.into_response(), + Err(e) => e.into_response(), + } + } +}