served icon indicating copy to clipboard operation
served copied to clipboard

Unable to send query parameters

Open rehovicova opened this issue 4 years ago • 1 comments

Hi, I am not able to send query parameters. I tried this:

mux.handle("api/moveby/{x}")
	.post([](served::response & res, const served::request & req) {
            std::string x = req.params["x"]; // gets x from path
            std::string y = req.query["y"]; // gets nothing
        }

I am using curl: curl -d y=2 localhost:8080/api/moveby/1

No matter what I do I can't retrieve it. And I don't really want to use path params.

rehovicova avatar Jul 10 '20 12:07 rehovicova

I have the same issue. I am unable to get any data when sending parameters with a post request. I've tried sending it as form-data, form-urlencoded, json, etc but nothing seems to work. The examples are not very clear on this.

dominique120 avatar Sep 26 '20 04:09 dominique120