fix #29 by uri encoding and decoding json
This commit is contained in:
parent
28cef77806
commit
515d74a1ea
|
@ -402,7 +402,7 @@ var utils = {
|
||||||
var req = http.request({
|
var req = http.request({
|
||||||
socketPath: state._ipc.path
|
socketPath: state._ipc.path
|
||||||
, method: 'POST'
|
, method: 'POST'
|
||||||
, path: '/rpc/' + service + '?_body=' + JSON.stringify(args)
|
, path: '/rpc/' + service + '?_body=' + encodeURIComponent(JSON.stringify(args))
|
||||||
}, function (resp) {
|
}, function (resp) {
|
||||||
|
|
||||||
function finish() {
|
function finish() {
|
||||||
|
|
|
@ -278,7 +278,7 @@ function serveControlsHelper() {
|
||||||
var opts = url.parse(req.url, true);
|
var opts = url.parse(req.url, true);
|
||||||
if (opts.query._body) {
|
if (opts.query._body) {
|
||||||
try {
|
try {
|
||||||
opts.body = JSON.parse(opts.query._body, true);
|
opts.body = JSON.parse(decodeURIComponent(opts.query._body, true));
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
res.statusCode = 500;
|
res.statusCode = 500;
|
||||||
res.end('{"error":{"message":"?_body={{bad_format}}"}}');
|
res.end('{"error":{"message":"?_body={{bad_format}}"}}');
|
||||||
|
|
Loading…
Reference in New Issue