diff --git a/examples/multipart/Cargo.toml b/examples/multipart/Cargo.toml index 5a8d582e9..bfe89f82b 100644 --- a/examples/multipart/Cargo.toml +++ b/examples/multipart/Cargo.toml @@ -11,5 +11,4 @@ path = "src/main.rs" env_logger = "*" futures = "0.1" actix = "^0.3.1" -#actix-web = { git = "https://github.com/actix/actix-web.git" } -actix-web = { path = "../../" } +actix-web = { git = "https://github.com/actix/actix-web.git" } diff --git a/examples/multipart/src/main.rs b/examples/multipart/src/main.rs index ac3714ad0..0b3dfb1da 100644 --- a/examples/multipart/src/main.rs +++ b/examples/multipart/src/main.rs @@ -28,7 +28,7 @@ fn index(mut req: HttpRequest) -> Box> field.map_err(Error::from) .map(|chunk| { println!("-- CHUNK: \n{}", - std::str::from_utf8(&chunk.0).unwrap());}) + std::str::from_utf8(&chunk).unwrap());}) .fold((), |_, _| result::<_, Error>(Ok(())))) }, multipart::MultipartItem::Nested(mp) => { diff --git a/guide/src/qs_7.md b/guide/src/qs_7.md index 2ab8e69ac..3d4ef7be6 100644 --- a/guide/src/qs_7.md +++ b/guide/src/qs_7.md @@ -114,6 +114,8 @@ fn index(req: HttpRequest) -> HttpResponse { ## Multipart body + + [WIP] ## Urlencoded body diff --git a/src/multipart.rs b/src/multipart.rs index 634b6652f..aa3f72018 100644 --- a/src/multipart.rs +++ b/src/multipart.rs @@ -377,10 +377,6 @@ pub struct Field { safety: Safety, } -/// A field's chunk -#[derive(PartialEq, Debug)] -pub struct FieldChunk(pub Bytes); - impl Field { fn new(safety: Safety, headers: HeaderMap, @@ -403,7 +399,7 @@ impl Field { } impl Stream for Field { - type Item = FieldChunk; + type Item = Bytes; type Error = MultipartError; fn poll(&mut self) -> Poll, Self::Error> { @@ -522,7 +518,7 @@ impl InnerField { } } - fn poll(&mut self, s: &Safety) -> Poll, MultipartError> { + fn poll(&mut self, s: &Safety) -> Poll, MultipartError> { if self.payload.is_none() { return Ok(Async::Ready(None)) } @@ -554,7 +550,7 @@ impl InnerField { match res { Async::NotReady => Async::NotReady, - Async::Ready(Some(bytes)) => Async::Ready(Some(FieldChunk(bytes))), + Async::Ready(Some(bytes)) => Async::Ready(Some(bytes)), Async::Ready(None) => { self.eof = true; match payload.readline().poll()? { @@ -734,7 +730,7 @@ mod tests { match field.poll() { Ok(Async::Ready(Some(chunk))) => - assert_eq!(chunk.0, "test"), + assert_eq!(chunk, "test"), _ => unreachable!() } match field.poll() { @@ -757,7 +753,7 @@ mod tests { match field.poll() { Ok(Async::Ready(Some(chunk))) => - assert_eq!(chunk.0, "data"), + assert_eq!(chunk, "data"), _ => unreachable!() } match field.poll() {