feat(http): allow specifying custom body streams
This commit is contained in:
		| @@ -133,6 +133,23 @@ pub trait Http1Transaction { | ||||
|  | ||||
| type ParseResult<T> = ::Result<Option<(MessageHead<T>, usize)>>; | ||||
|  | ||||
| struct DebugTruncate<'a>(&'a [u8]); | ||||
|  | ||||
| impl<'a> fmt::Debug for DebugTruncate<'a> { | ||||
|     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||||
|         let bytes = self.0; | ||||
|         if bytes.len() > 32 { | ||||
|             try!(f.write_str("[")); | ||||
|             for byte in &bytes[..32] { | ||||
|                 try!(write!(f, "{:?}, ", byte)); | ||||
|             } | ||||
|             write!(f, "... {}]", bytes.len()) | ||||
|         } else { | ||||
|             fmt::Debug::fmt(bytes, f) | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[test] | ||||
| fn test_should_keep_alive() { | ||||
|     let mut headers = Headers::new(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user