From 31a301c9a6e39ec1995ebdbefefb1a79c4a84754 Mon Sep 17 00:00:00 2001 From: axon-q Date: Thu, 7 Jun 2018 11:38:35 +0000 Subject: [PATCH] fix multipart test --- src/multipart.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/multipart.rs b/src/multipart.rs index 632a40c24..9727ec0a1 100644 --- a/src/multipart.rs +++ b/src/multipart.rs @@ -736,9 +736,11 @@ mod tests { let bytes = Bytes::from( "testasdadsad\r\n\ --abbc761f78ff4d7cb7573b5a23f96ef0\r\n\ + Content-Disposition: form-data; name=\"file\"; filename=\"fn.txt\"\r\n\ Content-Type: text/plain; charset=utf-8\r\nContent-Length: 4\r\n\r\n\ test\r\n\ --abbc761f78ff4d7cb7573b5a23f96ef0\r\n\ + Content-Disposition: form-data; name=\"file\"; filename=\"fn.txt\"\r\n\ Content-Type: text/plain; charset=utf-8\r\nContent-Length: 4\r\n\r\n\ data\r\n\ --abbc761f78ff4d7cb7573b5a23f96ef0--\r\n"); @@ -751,6 +753,12 @@ mod tests { match multipart.poll() { Ok(Async::Ready(Some(item))) => match item { MultipartItem::Field(mut field) => { + { + use http::header::{DispositionType, DispositionParam}; + let cd = field.content_disposition(); + assert_eq!(cd.disposition, DispositionType::Ext("form-data".into())); + assert_eq!(cd.parameters[0], DispositionParam::Ext("name".into(), "file".into())); + } assert_eq!(field.content_type().type_(), mime::TEXT); assert_eq!(field.content_type().subtype(), mime::PLAIN);