restconf json err return: too many {}
This commit is contained in:
parent
03be9c0567
commit
9b951b5ce6
2 changed files with 13 additions and 6 deletions
|
|
@ -188,12 +188,19 @@ api_return_err(clicon_handle h,
|
|||
FCGX_FPrintF(r->out, " </errors>\r\n");
|
||||
}
|
||||
else{
|
||||
FCGX_FPrintF(r->out, "{%s", pretty?"\r\n":"");
|
||||
FCGX_FPrintF(r->out, " \"ietf-restconf:errors\" : {%s", pretty?"\r\n":"");
|
||||
FCGX_FPrintF(r->out, " %s", cbuf_get(cb));
|
||||
FCGX_FPrintF(r->out, " }%s", pretty?"\r\n":"");
|
||||
if (pretty){
|
||||
FCGX_FPrintF(r->out, "{\r\n");
|
||||
FCGX_FPrintF(r->out, " \"ietf-restconf:errors\" : %s\r\n",
|
||||
cbuf_get(cb));
|
||||
FCGX_FPrintF(r->out, "}\r\n");
|
||||
}
|
||||
else{
|
||||
FCGX_FPrintF(r->out, "{");
|
||||
FCGX_FPrintF(r->out, "\"ietf-restconf:errors\" : ");
|
||||
FCGX_FPrintF(r->out, "%s", cbuf_get(cb));
|
||||
FCGX_FPrintF(r->out, "}\r\n");
|
||||
}
|
||||
}
|
||||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ if [ -z "$match" ]; then
|
|||
fi
|
||||
|
||||
new "restconf Re-add subtree which should give error"
|
||||
expectfn 'curl -s -i -X POST -d {"interfaces":{"interface":{"name":"eth/0/0","type":"eth","enabled":true}}} http://localhost/restconf/data' '{"error-tag": "operation-failed"'
|
||||
expectfn 'curl -s -X POST -d {"interfaces":{"interface":{"name":"eth/0/0","type":"eth","enabled":true}}} http://localhost/restconf/data' '{"ietf-restconf:errors" : {"error": {"error-tag": "operation-failed","error-type": "protocol","error-severity": "error","error-message": "Object to create already exists"}}}'
|
||||
|
||||
new "restconf Check interfaces eth/0/0 added"
|
||||
expectfn "curl -s -G http://localhost/restconf/data" '{"interfaces": {"interface": \[{"name": "eth/0/0","type": "eth","enabled": true}\]},"interfaces-state": {"interface": \[{"name": "eth0","type": "eth","if-index": 42}\]}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue