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
might be this error #228
I'll try to fix it today
Could you provide client code?
Sorry for the delay.
[dependencies]
futures = "0.1"
reqwest = { version = "0.8", features = [ "unstable" ] }
serde = "1.0"
serde_derive = "1.0"
tokio-core = "0.1"
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
Most helpful comment
I'll try to fix it today