1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-28 01:52:57 +01:00
actix-web/actix-web-codegen/tests/test_macro.rs

18 lines
474 B
Rust
Raw Normal View History

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());
}