fix(client): fix panics when some errors occured inside HttpMessage
BREAKING CHANGE: This changes the signature of HttpWriter.end(), returning a `EndError` that is similar to std::io::IntoInnerError, allowing HttpMessage to retrieve the broken connections and not panic. The breaking change isn't exposed in any usage of the `Client` API, but for anyone using `HttpWriter` directly, since this was technically a public method, that change is breaking.
This commit is contained in:
		| @@ -226,4 +226,14 @@ mod tests { | ||||
|  | ||||
|         assert_eq!(read_to_string(res).unwrap(), "1".to_owned()); | ||||
|     } | ||||
|  | ||||
|     #[test] | ||||
|     fn test_parse_error_closes() { | ||||
|         let url = Url::parse("http://hyper.rs").unwrap(); | ||||
|         let stream = MockStream::with_input(b"\ | ||||
|             definitely not http | ||||
|         "); | ||||
|  | ||||
|         assert!(Response::new(url, Box::new(stream)).is_err()); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user