loentar / ngrest

Fast and easy C++ RESTful WebServices framework
Apache License 2.0
464 stars 93 forks source link

Can't find divider #16

Closed alparslansari closed 8 years ago

alparslansari commented 8 years ago

Hi,

I am trying to use multiple parameters in my service.

I tried to call it like curl http://localhost:9098/geemail_ws/userRegister?username={aa}&password={a} curl http://localhost:9098/geemail_ws/userRegister?username='aa'&password='a'

However, I am getting following error:

W/09-11-2016 20:36:05.890 ServiceDispatcher.cpp:440 dispatchMessage : Can't find divider [&password=] for path: /geemail_ws/userRegister?username=aa?password=a

.h file std::string userRegister(const std::string& username, const std::string& password);

.cpp std::string Geemail_ws::userRegister(const std::string& username, const std::string& password) { return "username="+username+" password="+password; }

If I use one parameter it is OK: curl http://localhost:9098/geemail_ws/registerController?param={aa} But I wonder what is the problem for multiple params?

loentar commented 8 years ago

Actually, when you have '&' symbol in your command line you must quote it. Else it will be interpreted as "start process in background" and the actual command will be cut to the ampersand, i.e. without your second parameter.

The correct line is:

curl 'http://localhost:9098/geemail_ws/userRegister?username=qwe&password=asd'