fix #29 by uri encoding and decoding json

This commit is contained in:
AJ ONeal 2018-07-26 11:26:11 -06:00
父節點 28cef77806
當前提交 515d74a1ea
共有 2 個文件被更改,包括 2 次插入2 次删除

查看文件

@ -402,7 +402,7 @@ var utils = {
var req = http.request({
socketPath: state._ipc.path
, method: 'POST'
, path: '/rpc/' + service + '?_body=' + JSON.stringify(args)
, path: '/rpc/' + service + '?_body=' + encodeURIComponent(JSON.stringify(args))
}, function (resp) {
function finish() {

查看文件

@ -278,7 +278,7 @@ function serveControlsHelper() {
var opts = url.parse(req.url, true);
if (opts.query._body) {
try {
opts.body = JSON.parse(opts.query._body, true);
opts.body = JSON.parse(decodeURIComponent(opts.query._body, true));
} catch(e) {
res.statusCode = 500;
res.end('{"error":{"message":"?_body={{bad_format}}"}}');