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

@@ -100,11 +100,11 @@ mod tests {
status: status::Ok,
headers: Headers::new(),
version: version::Http11,
body: EofReader(BufferedReader::new(box MockStream as Box<NetworkStream + Send>))
body: EofReader(BufferedReader::new(box MockStream::new() as Box<NetworkStream + Send>))
};
let b = res.unwrap().downcast::<MockStream>().unwrap();
assert_eq!(b, box MockStream);
assert_eq!(b, box MockStream::new());
}
}