mirror of
https://github.com/fafhrd91/actix-web
synced 2025-07-01 00:44:26 +02:00
simplify AnyBody
and BodySize
(#2446)
This commit is contained in:
@ -387,7 +387,7 @@ impl HttpResponseBuilder {
|
||||
/// `HttpResponseBuilder` can not be used after this call.
|
||||
#[inline]
|
||||
pub fn finish(&mut self) -> HttpResponse {
|
||||
self.body(AnyBody::Empty)
|
||||
self.body(AnyBody::empty())
|
||||
}
|
||||
|
||||
/// This method construct new `HttpResponseBuilder`
|
||||
@ -475,7 +475,7 @@ mod tests {
|
||||
fn test_content_type() {
|
||||
let resp = HttpResponseBuilder::new(StatusCode::OK)
|
||||
.content_type("text/plain")
|
||||
.body(Body::Empty);
|
||||
.body(Body::empty());
|
||||
assert_eq!(resp.headers().get(CONTENT_TYPE).unwrap(), "text/plain")
|
||||
}
|
||||
|
||||
|
@ -87,13 +87,12 @@ impl HttpResponse {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::dev::Body;
|
||||
use crate::http::StatusCode;
|
||||
use crate::HttpResponse;
|
||||
|
||||
#[test]
|
||||
fn test_build() {
|
||||
let resp = HttpResponse::Ok().body(Body::Empty);
|
||||
let resp = HttpResponse::Ok().finish();
|
||||
assert_eq!(resp.status(), StatusCode::OK);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user