1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 14:49:20 +02:00

revert generic service request; add ServerConfig to service factories

This commit is contained in:
Nikolay Kim
2019-03-09 07:37:23 -08:00
parent e324522389
commit ca73f178c9
21 changed files with 222 additions and 139 deletions

View File

@ -565,17 +565,22 @@ fn test_body_chunked_implicit() {
assert_eq!(bytes, Bytes::from_static(STR.as_ref()));
}
use actix_server_config::ServerConfig;
use actix_service::fn_cfg_factory;
#[test]
fn test_response_http_error_handling() {
let mut srv = TestServer::new(|| {
h1::H1Service::new(|_| {
let broken_header = Bytes::from_static(b"\0\0\0");
ok::<_, ()>(
Response::Ok()
.header(http::header::CONTENT_TYPE, broken_header)
.body(STR),
)
})
h1::H1Service::new(fn_cfg_factory(|_: &ServerConfig| {
Ok::<_, ()>(|_| {
let broken_header = Bytes::from_static(b"\0\0\0");
ok::<_, ()>(
Response::Ok()
.header(http::header::CONTENT_TYPE, broken_header)
.body(STR),
)
})
}))
});
let req = srv.get().finish().unwrap();