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({
|
||||
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}}"}}');
|
||||
|
|
Loading…
Reference in New Issue