[−][src]Function actix_testing::call_service
pub fn call_service<S, R>(app: &mut S, req: R) -> S::Response where
S: Service<Request = R>,
S::Error: Debug,
Calls service and waits for response future completion.
ⓘThis example is not tested
use actix_web::{test, App, HttpResponse, http::StatusCode}; use actix_service::Service; #[test] fn test_response() { let mut app = test::init_service( App::new() .service(web::resource("/test").to(|| HttpResponse::Ok())) ); // Create request object let req = test::TestRequest::with_uri("/test").to_request(); // Call application let resp = test::call_service(&mut app, req); assert_eq!(resp.status(), StatusCode::OK); }