Actix-web: Error occured during request handling: Can not decode chunked transfer encoding

Created on 30 May 2018  路  5Comments  路  Source: actix/actix-web

I'm trying to post a form from reqwest to actix-web.

It works if I use curl (which doesn't use Transfer-Encoding: chunked)

The request looks like this:

POST /login HTTP/1.1
Host: localhost:8080
User-Agent: reqwest/0.8.5
Accept: */*
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip
Transfer-Encoding: chunked

username=a&password=b&group=c

the error is:

actix_web::pipeline: Error occured during request handling: Can not decode chunked transfer encoding

Most helpful comment

I'll try to fix it today

All 5 comments

might be this error #228

I'll try to fix it today

Could you provide client code?

Sorry for the delay.

deps
[dependencies]
futures = "0.1"
reqwest = { version = "0.8", features = [ "unstable" ] }
serde = "1.0"
serde_derive = "1.0"
tokio-core = "0.1"
code
extern crate futures;
extern crate reqwest;
extern crate serde;
extern crate tokio_core;

#[macro_use]
extern crate serde_derive;

use futures::future::Future;
use reqwest::unstable::async::Client;
use tokio_core::reactor::Core;

#[derive(Serialize)]
struct FormData {
    username: String,
    password: String,
}

fn main() {
    let mut core = Core::new().unwrap();
    let handle = core.handle();

    let client = Client::new(&handle);

    let form = FormData {
        username: "user".to_string(),
        password: "password".to_string(),
    };

    let work = client
        .post("http://localhost:8080/login")
        .form(&form)
        .send()
        .and_then(|res| {
            println!("{}", res.status());
            Ok(())
        });

    core.run(work).unwrap();
}

fixed in master

Was this page helpful?
0 / 5 - 0 ratings