When calling request.form(data) with a form body that looks roughly like this:
// {"nested": {"yes": "y"}, "user": "foo", "password": "fizz"}
Some(Form(Object({"nested": Object({"yes": String("y")}), "password": String("fizz"), "user": String("foo")}))) }
I'm getting the following error:
Error(Reqwest(Error { kind: UrlEncoded(Custom("unsupported value")), url: None }), State { next_error: None, backtrace: None })
I would expect reqwest to send the following request body:
nested[yes]=y&password=fizz&user=foo
I ran across this same limitation when trying to use .query(data) with a Vec of values assigned to a key. I raised an issue on the serde_urlencoded project and was told it was out of scope for the project and referred to serde_qs. serde_qs appears to support the cases that @kpcyrd and I were attempting to use.
I propose that we investigate switching to using serde_qs in reqwest if possible. In the meantime, it could be useful to document this limitation and potential workarounds (eg. is it possible to pre-serialize using serde_qs and pass it to .query or .form as a string without issue?).
Hi, I am getting this issue on my project
Err(Error(UrlEncoded(Custom("unsupported value"))))
I am using an vector assigned to 1 of my keys.
Most helpful comment
I ran across this same limitation when trying to use
.query(data)with a Vec of values assigned to a key. I raised an issue on the serde_urlencoded project and was told it was out of scope for the project and referred to serde_qs.serde_qsappears to support the cases that @kpcyrd and I were attempting to use.I propose that we investigate switching to using
serde_qsin reqwest if possible. In the meantime, it could be useful to document this limitation and potential workarounds (eg. is it possible to pre-serialize using serde_qs and pass it to.queryor.formas a string without issue?).