2019-03-17 21:55:03 +01:00
|
|
|
use actix_http::HttpService;
|
|
|
|
use actix_http_test::TestServer;
|
2019-03-26 20:50:51 +01:00
|
|
|
use actix_web::{get, http, App, HttpResponse, Responder};
|
2019-03-17 21:55:03 +01:00
|
|
|
|
|
|
|
#[get("/test")]
|
|
|
|
fn test() -> impl Responder {
|
|
|
|
HttpResponse::Ok()
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_body() {
|
|
|
|
let mut srv = TestServer::new(|| HttpService::new(App::new().service(test)));
|
|
|
|
|
2019-03-26 20:50:51 +01:00
|
|
|
let request = srv.request(http::Method::GET, srv.url("/test"));
|
|
|
|
let response = srv.block_on(request.send()).unwrap();
|
2019-03-17 21:55:03 +01:00
|
|
|
assert!(response.status().is_success());
|
|
|
|
}
|