File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
5
+ - Implement ` Responder ` for ` Result<(), E: Into<Error>> ` . Returning ` Ok(()) ` responds with HTTP 204 No Content.
5
6
- On Windows, an error is now returned from ` HttpServer::bind() ` (or TLS variants) when binding to a socket that's already in use.
6
7
- Update ` brotli ` dependency to ` 7 ` .
7
8
- Minimum supported Rust version (MSRV) is now 1.75.
Original file line number Diff line number Diff line change @@ -131,6 +131,23 @@ where
131
131
}
132
132
}
133
133
134
+ // Note: see https://github.com/actix/actix-web/issues/1108 for reasoning why Responder is not
135
+ // implemented for `()`, and https://github.com/actix/actix-web/pull/3560 for discussion about this
136
+ // impl and the decision not to include a similar one for `Option<()>`.
137
+ impl < E > Responder for Result < ( ) , E >
138
+ where
139
+ E : Into < Error > ,
140
+ {
141
+ type Body = BoxBody ;
142
+
143
+ fn respond_to ( self , _req : & HttpRequest ) -> HttpResponse {
144
+ match self {
145
+ Ok ( ( ) ) => HttpResponse :: new ( StatusCode :: NO_CONTENT ) ,
146
+ Err ( err) => HttpResponse :: from_error ( err. into ( ) ) ,
147
+ }
148
+ }
149
+ }
150
+
134
151
impl < R : Responder > Responder for ( R , StatusCode ) {
135
152
type Body = R :: Body ;
136
153
You can’t perform that action at this time.
0 commit comments