fix(client): GET and HEAD shouldn't add Transfer-Encoding

Also adds an EmptyWriter, used for GET and HEAD requests,
which will return an io::ShortWrite error if the user ever tries
to write to a GET or HEAD request.

Closes #77
This commit is contained in:
Sean McArthur
2014-11-09 12:13:12 -08:00
parent caab60e374
commit 3b8c5cac1a
5 changed files with 142 additions and 49 deletions

View File

@@ -274,19 +274,19 @@ mod tests {
#[test]
fn test_downcast_box_stream() {
let stream = box MockStream as Box<NetworkStream + Send>;
let stream = box MockStream::new() as Box<NetworkStream + Send>;
let mock = stream.downcast::<MockStream>().unwrap();
assert_eq!(mock, box MockStream);
assert_eq!(mock, box MockStream::new());
}
#[test]
fn test_downcast_unchecked_box_stream() {
let stream = box MockStream as Box<NetworkStream + Send>;
let stream = box MockStream::new() as Box<NetworkStream + Send>;
let mock = unsafe { stream.downcast_unchecked::<MockStream>() };
assert_eq!(mock, box MockStream);
assert_eq!(mock, box MockStream::new());
}