test chunked + content-length
This commit is contained in:
@@ -40,3 +40,21 @@ fn content_length_limited() {
|
|||||||
reader.read_to_string(&mut text).unwrap();
|
reader.read_to_string(&mut text).unwrap();
|
||||||
assert_eq!(text, "abcd");
|
assert_eq!(text, "abcd");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
// content-length should be ignnored when chunked
|
||||||
|
fn ignore_content_length_when_chunked() {
|
||||||
|
test::set_handler("/ignore_content_length_when_chunked", |_req, _url| {
|
||||||
|
test::make_stream(
|
||||||
|
200,
|
||||||
|
"OK",
|
||||||
|
vec!["Content-Length: 4", "transfer-encoding: chunked"],
|
||||||
|
"3\r\nhel\r\nb\r\nlo world!!!\r\n0\r\n\r\n".to_string().into_bytes(),
|
||||||
|
)
|
||||||
|
});
|
||||||
|
let resp = get("test://host/ignore_content_length_when_chunked").call();
|
||||||
|
let mut reader = resp.into_reader();
|
||||||
|
let mut text = String::new();
|
||||||
|
reader.read_to_string(&mut text).unwrap();
|
||||||
|
assert_eq!(text, "hello world!!!");
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user