diff --git a/CHANGELOG.md b/CHANGELOG.md index bde6ab36..6ced2f8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -115,6 +115,7 @@ * Added libgen.h for baseline() ### Corrected Bugs +* [Invalid JSON if GET /operations via RESTCONF #82](https://github.com/clicon/clixon/issues/82), thanks achernavin22 * List ordering bug - lists with ints as keys behaved wrongly and slow. * NACM read default rule did not work properly if nacm was enabled AND no groups were defined * Re-inserted `cli_output_reset` for what was erroneuos thought to be an obsolete function diff --git a/apps/restconf/restconf_methods.c b/apps/restconf/restconf_methods.c index f517bac8..b4243689 100644 --- a/apps/restconf/restconf_methods.c +++ b/apps/restconf/restconf_methods.c @@ -1164,7 +1164,7 @@ api_operations_get(clicon_handle h, if (use_xml) cprintf(cbx, ""); else - cprintf(cbx, "}"); + cprintf(cbx, "}}"); FCGX_SetExitStatus(200, r->out); /* OK */ FCGX_FPrintF(r->out, "Content-Type: application/yang-data+%s\r\n", use_xml?"xml":"json"); FCGX_FPrintF(r->out, "\r\n"); diff --git a/test/test_restconf.sh b/test/test_restconf.sh index f916952a..a5a76321 100755 --- a/test/test_restconf.sh +++ b/test/test_restconf.sh @@ -73,7 +73,7 @@ expecteq "$(curl -s -H 'Accept: application/yang-data+xml' -G http://localhost/r # Should be alphabetically ordered new "restconf get restconf/operations. RFC8040 3.3.2 (json)" -expecteq "$(curl -sG http://localhost/restconf/operations)" 0 '{"operations": {"clixon-example:client-rpc": null,"clixon-example:empty": null,"clixon-example:optional": null,"clixon-example:example": null,"clixon-lib:debug": null} +expecteq "$(curl -sG http://localhost/restconf/operations)" 0 '{"operations": {"clixon-example:client-rpc": null,"clixon-example:empty": null,"clixon-example:optional": null,"clixon-example:example": null,"clixon-lib:debug": null}} ' new "restconf get restconf/operations. RFC8040 3.3.2 (xml)"