From ccb6ebb2598767c032ae3839111e8fe6ced174a2 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 27 Feb 2018 20:49:53 -0800 Subject: [PATCH] headers test --- tests/test_server.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_server.rs b/tests/test_server.rs index 0aa3f1bd3..4a4a1538c 100644 --- a/tests/test_server.rs +++ b/tests/test_server.rs @@ -133,6 +133,25 @@ fn test_simple() { 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] fn test_body() { let mut srv = test::TestServer::new(