Skip to content

Commit 42ff4e3

Browse files
committed
Remove params key from cURL requests that take no params
1 parent f4a4354 commit 42ff4e3

File tree

1 file changed

+5
-2
lines changed
  • mopidy_api_explorer/static/js

1 file changed

+5
-2
lines changed

mopidy_api_explorer/static/js/app.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,14 @@ Handlebars.registerHelper("concat", function() {
4848

4949
Handlebars.registerHelper("apiMethodCurlCall", function(apiMethod) {
5050
const cmd = {
51-
method: apiMethod.methodName,
5251
jsonrpc: "2.0",
53-
params: apiMethod.methodData.params,
5452
id: 1,
53+
method: apiMethod.methodName,
5554
};
55+
if (Object.keys(apiMethod.methodData.params).length > 0) {
56+
cmd.params = apiMethod.methodData.params;
57+
}
58+
5659
return "curl -X POST -H 'Content-Type: application/json'" +
5760
` -d '${JSON.stringify(cmd, null, 2)}' ` +
5861
window.location.origin + "/mopidy/rpc";

0 commit comments

Comments
 (0)