开发者

qx.io.remote.Request: post parameters in body and url

when creating and sending an http POST request like this...

        var req = new qx.io.remote.Request("/test","POST");
        req.setParameter("pi", "3.1415");
        req.setParameter("color", "red");
        req.setParameter("password", "mySecretPassword");
        req.send();

... paramters are send in the body and in t开发者_StackOverflow中文版he url. this is a problem because parameters may break when getting bigger, and for security reasons it is not ok for all parameters to show up in logfiles. am i doing something wrong, or is this a bug? my workaround is to concat and uriencode parameters by myself and put them in the body with req.setData(data).


.setParameter has an optional third argument. If set to true, the parameter for the request will go into the data section instead of the URL; see the API doc.


Take a look at the documentation at http://demo.qooxdoo.org/current/apiviewer/#qx.io.remote.Request for the setParameter-method.

setParameter(String vId, var vValue, (Boolean | false) bAsData) has an optional third parameter bAsData

If false, add the parameter to the URL. If true then instead the parameters added by calls to this method will be combined into a string added as the request data, as if the entire set of parameters had been pre-build and passed to setData().

So adding an third parameter with the value true to your req.setParameter should do the trick.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜