1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 01:32:57 +01:00

headers test

This commit is contained in:
Nikolay Kim 2018-02-27 20:49:53 -08:00
parent da76de76f0
commit ccb6ebb259

View File

@ -133,6 +133,25 @@ fn test_simple() {
assert!(response.status().is_success()); assert!(response.status().is_success());
} }
#[test]
fn test_headers() {
let mut srv = test::TestServer::new(
|app| app.handler(|_| {
let mut builder = httpcodes::HTTPOk.build();
for idx in 0..90 {
builder.header(format!("X-TEST-{}", idx).as_str(), "TEST TEST TEST");
}
builder.body(STR)}));
let request = srv.get().finish().unwrap();
let response = srv.execute(request.send()).unwrap();
assert!(response.status().is_success());
// read response
let bytes = srv.execute(response.body()).unwrap();
assert_eq!(Bytes::from(bytes), Bytes::from_static(STR.as_ref()));
}
#[test] #[test]
fn test_body() { fn test_body() {
let mut srv = test::TestServer::new( let mut srv = test::TestServer::new(