1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-01-15 21:12:54 +01:00

18 lines
474 B
Rust
Raw Normal View History

2019-03-17 13:55:03 -07:00
use actix_http::HttpService;
use actix_http_test::TestServer;
2019-03-26 12:50:51 -07:00
use actix_web::{get, http, App, HttpResponse, Responder};
2019-03-17 13:55:03 -07: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 12:50:51 -07:00
let request = srv.request(http::Method::GET, srv.url("/test"));
let response = srv.block_on(request.send()).unwrap();
2019-03-17 13:55:03 -07:00
assert!(response.status().is_success());
}