served
served copied to clipboard
Unable to send query parameters
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.
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.