mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-27 09:42:57 +01:00
rename simple_service to status_service (#2659)
This commit is contained in:
parent
5aa6f713c7
commit
11bfa84926
@ -43,7 +43,7 @@ pub use actix_http_test::unused_addr;
|
||||
use actix_service::{map_config, IntoServiceFactory, ServiceFactory, ServiceFactoryExt as _};
|
||||
pub use actix_web::test::{
|
||||
call_and_read_body, call_and_read_body_json, call_service, init_service, ok_service,
|
||||
read_body, read_body_json, simple_service, TestRequest,
|
||||
read_body, read_body_json, status_service, TestRequest,
|
||||
};
|
||||
use actix_web::{
|
||||
body::MessageBody,
|
||||
|
@ -1,6 +1,9 @@
|
||||
# Changes
|
||||
|
||||
## Unreleased - 2021-xx-xx
|
||||
- Rename `test::{simple_service => status_service}`. [#2659]
|
||||
|
||||
[#2659]: https://github.com/actix/actix-web/pull/2659
|
||||
|
||||
|
||||
## 4.0.0-rc.3 - 2022-02-08
|
||||
|
@ -191,7 +191,6 @@ mod tests {
|
||||
StatusCode,
|
||||
},
|
||||
test::{self, TestRequest},
|
||||
ResponseError,
|
||||
};
|
||||
|
||||
#[actix_rt::test]
|
||||
@ -205,7 +204,7 @@ mod tests {
|
||||
Ok(ErrorHandlerResponse::Response(res.map_into_left_body()))
|
||||
}
|
||||
|
||||
let srv = test::simple_service(StatusCode::INTERNAL_SERVER_ERROR);
|
||||
let srv = test::status_service(StatusCode::INTERNAL_SERVER_ERROR);
|
||||
|
||||
let mw = ErrorHandlers::new()
|
||||
.handler(StatusCode::INTERNAL_SERVER_ERROR, error_handler)
|
||||
@ -232,7 +231,7 @@ mod tests {
|
||||
))
|
||||
}
|
||||
|
||||
let srv = test::simple_service(StatusCode::INTERNAL_SERVER_ERROR);
|
||||
let srv = test::status_service(StatusCode::INTERNAL_SERVER_ERROR);
|
||||
|
||||
let mw = ErrorHandlers::new()
|
||||
.handler(StatusCode::INTERNAL_SERVER_ERROR, error_handler)
|
||||
@ -258,7 +257,7 @@ mod tests {
|
||||
Ok(ErrorHandlerResponse::Response(res))
|
||||
}
|
||||
|
||||
let srv = test::simple_service(StatusCode::INTERNAL_SERVER_ERROR);
|
||||
let srv = test::status_service(StatusCode::INTERNAL_SERVER_ERROR);
|
||||
|
||||
let mw = ErrorHandlers::new()
|
||||
.handler(StatusCode::INTERNAL_SERVER_ERROR, error_handler)
|
||||
@ -279,7 +278,7 @@ mod tests {
|
||||
))
|
||||
}
|
||||
|
||||
let srv = test::simple_service(StatusCode::BAD_REQUEST);
|
||||
let srv = test::status_service(StatusCode::BAD_REQUEST);
|
||||
|
||||
let mw = ErrorHandlers::new()
|
||||
.handler(StatusCode::BAD_REQUEST, error_handler)
|
||||
|
@ -5,7 +5,7 @@
|
||||
//!
|
||||
//! # Off-The-Shelf Test Services
|
||||
//! - [`ok_service`]
|
||||
//! - [`simple_service`]
|
||||
//! - [`status_service`]
|
||||
//!
|
||||
//! # Calling Test Service
|
||||
//! - [`TestRequest`]
|
||||
@ -27,7 +27,7 @@ mod test_utils;
|
||||
|
||||
pub use self::test_request::TestRequest;
|
||||
#[allow(deprecated)]
|
||||
pub use self::test_services::{default_service, ok_service, simple_service};
|
||||
pub use self::test_services::{default_service, ok_service, simple_service, status_service};
|
||||
#[allow(deprecated)]
|
||||
pub use self::test_utils::{
|
||||
call_and_read_body, call_and_read_body_json, call_service, init_service, read_body,
|
||||
|
@ -10,11 +10,11 @@ use crate::{
|
||||
/// Creates service that always responds with `200 OK` and no body.
|
||||
pub fn ok_service(
|
||||
) -> impl Service<ServiceRequest, Response = ServiceResponse<BoxBody>, Error = Error> {
|
||||
simple_service(StatusCode::OK)
|
||||
status_service(StatusCode::OK)
|
||||
}
|
||||
|
||||
/// Creates service that always responds with given status code and no body.
|
||||
pub fn simple_service(
|
||||
pub fn status_service(
|
||||
status_code: StatusCode,
|
||||
) -> impl Service<ServiceRequest, Response = ServiceResponse<BoxBody>, Error = Error> {
|
||||
fn_service(move |req: ServiceRequest| {
|
||||
@ -23,9 +23,17 @@ pub fn simple_service(
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[deprecated(since = "4.0.0", note = "Renamed to `simple_service`.")]
|
||||
#[deprecated(since = "4.0.0", note = "Renamed to `status_service`.")]
|
||||
pub fn simple_service(
|
||||
status_code: StatusCode,
|
||||
) -> impl Service<ServiceRequest, Response = ServiceResponse<BoxBody>, Error = Error> {
|
||||
status_service(status_code)
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[deprecated(since = "4.0.0", note = "Renamed to `status_service`.")]
|
||||
pub fn default_service(
|
||||
status_code: StatusCode,
|
||||
) -> impl Service<ServiceRequest, Response = ServiceResponse<BoxBody>, Error = Error> {
|
||||
simple_service(status_code)
|
||||
status_service(status_code)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user