tests
This commit is contained in:
@@ -15,8 +15,8 @@
|
|||||||
- [x] Auth headers
|
- [x] Auth headers
|
||||||
- [x] Repeated headers
|
- [x] Repeated headers
|
||||||
- [x] Cookie jar in agent
|
- [x] Cookie jar in agent
|
||||||
- [ ] Write tests for send body content-length
|
- [x] Write tests for send body content-length
|
||||||
- [ ] Write tests for send body chunked
|
- [x] Write tests for send body chunked
|
||||||
- [ ] Forms with application/x-www-form-urlencoded
|
- [ ] Forms with application/x-www-form-urlencoded
|
||||||
- [ ] multipart/form-data
|
- [ ] multipart/form-data
|
||||||
- [ ] Connection reuse/keep-alive with pool
|
- [ ] Connection reuse/keep-alive with pool
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ fn content_length_on_str() {
|
|||||||
.send_str("Hello World!!!");
|
.send_str("Hello World!!!");
|
||||||
let vec = resp.to_write_vec();
|
let vec = resp.to_write_vec();
|
||||||
let s = String::from_utf8_lossy(&vec);
|
let s = String::from_utf8_lossy(&vec);
|
||||||
assert!(s.contains("\r\nContent-Length: 14\r\n"))
|
assert!(s.contains("\r\nContent-Length: 14\r\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -25,5 +25,19 @@ fn content_length_on_json() {
|
|||||||
.send_json(SerdeValue::Object(json));
|
.send_json(SerdeValue::Object(json));
|
||||||
let vec = resp.to_write_vec();
|
let vec = resp.to_write_vec();
|
||||||
let s = String::from_utf8_lossy(&vec);
|
let s = String::from_utf8_lossy(&vec);
|
||||||
assert!(s.contains("\r\nContent-Length: 20\r\n"))
|
assert!(s.contains("\r\nContent-Length: 20\r\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn content_length_and_chunked() {
|
||||||
|
test::set_handler("/content_length_and_chunked", |_req, _url| {
|
||||||
|
test::make_response(200, "OK", vec![], vec![])
|
||||||
|
});
|
||||||
|
let resp = post("test://host/content_length_and_chunked")
|
||||||
|
.set("Transfer-Encoding", "chunked")
|
||||||
|
.send_str("Hello World!!!");
|
||||||
|
let vec = resp.to_write_vec();
|
||||||
|
let s = String::from_utf8_lossy(&vec);
|
||||||
|
assert!(s.contains("Transfer-Encoding: chunked\r\n"));
|
||||||
|
assert!(!s.contains("\r\nContent-Length:\r\n"));
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user