meltwater / served

A C++11 RESTful web server library
MIT License
710 stars 174 forks source link

Unable to send query parameters #71

Open rehovicova opened 4 years ago

rehovicova commented 4 years ago

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.

dominique120 commented 4 years ago

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.