fix #29 by uri encoding and decoding json

This commit is contained in:
AJ ONeal 2018-07-26 11:26:11 -06:00
parent 28cef77806
commit 515d74a1ea
2 changed files with 2 additions and 2 deletions

View File

@ -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() {

View File

@ -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}}"}}');