json-rpc: Remove double-quoting on errors in JSON-RPC

The use of `json_tok_full_len` and `json_tok_full` in addition to
single quotes will result in double quoting, which is really weird. I
opted to single quoting using `'` instead which does not need to be
escaped.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2019-01-20 15:58:51 +01:00
committed by Rusty Russell
parent c029f2fb0f
commit 5d05694920

View File

@@ -353,8 +353,8 @@ static struct command_result *json_help(struct command *cmd,
} }
return command_fail(cmd, JSONRPC2_METHOD_NOT_FOUND, return command_fail(cmd, JSONRPC2_METHOD_NOT_FOUND,
"Unknown command '%.*s'", "Unknown command '%.*s'",
json_tok_full_len(cmdtok), cmdtok->end - cmdtok->start,
json_tok_full(buffer, cmdtok)); buffer + cmdtok->start);
} }
response = json_stream_success(cmd); response = json_stream_success(cmd);
@@ -584,12 +584,11 @@ parse_request(struct json_connection *jcon, const jsmntok_t tok[])
"Expected string for method"); "Expected string for method");
} }
c->json_cmd = find_cmd(jcon->ld->jsonrpc, jcon->buffer, method); c->json_cmd = find_cmd(jcon->ld->jsonrpc, jcon->buffer, method);
if (!c->json_cmd) { if (!c->json_cmd) {
return command_fail(c, JSONRPC2_METHOD_NOT_FOUND, return command_fail(
"Unknown command '%.*s'", c, JSONRPC2_METHOD_NOT_FOUND, "Unknown command '%.*s'",
json_tok_full_len(method), method->end - method->start, jcon->buffer + method->start);
json_tok_full(jcon->buffer, method));
} }
if (c->json_cmd->deprecated && !deprecated_apis) { if (c->json_cmd->deprecated && !deprecated_apis) {
return command_fail(c, JSONRPC2_METHOD_NOT_FOUND, return command_fail(c, JSONRPC2_METHOD_NOT_FOUND,