From 009874125ec5760db2f4c611ae1475e63ae0134f Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 19 Dec 2017 10:25:23 -0800 Subject: [PATCH] add client.py comments --- examples/multipart/client.py | 4 +++- examples/multipart/src/main.rs | 10 ++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/multipart/client.py b/examples/multipart/client.py index 2e3068d4c..afc07f17d 100644 --- a/examples/multipart/client.py +++ b/examples/multipart/client.py @@ -1,7 +1,9 @@ +# This script could be used for actix-web multipart example test +# just start server and run client.py + import asyncio import aiohttp - async def req1(): with aiohttp.MultipartWriter() as writer: writer.append('test') diff --git a/examples/multipart/src/main.rs b/examples/multipart/src/main.rs index ed804fa88..b4ed98787 100644 --- a/examples/multipart/src/main.rs +++ b/examples/multipart/src/main.rs @@ -13,11 +13,10 @@ fn index(mut req: HttpRequest) -> Box> { println!("{:?}", req); - // get multipart stream and iterate over multipart items Box::new( - req.multipart() // <- get multipart stream for current request - .map_err(Error::from) - .and_then(|item| { // <- iterate over multipart items + req.multipart() // <- get multipart stream for current request + .map_err(Error::from) // <- convert multipart errors + .and_then(|item| { // <- iterate over multipart items match item { // Handle multipart Field multipart::MultipartItem::Field(field) => { @@ -50,8 +49,7 @@ fn main() { HttpServer::new( || Application::new() - // enable logger - .middleware(middlewares::Logger::default()) + .middleware(middlewares::Logger::default()) // <- logger .resource("/multipart", |r| r.method(Method::POST).a(index))) .bind("127.0.0.1:8080").unwrap() .start();