diff --git a/apps/restconf/restconf_main.c b/apps/restconf/restconf_main.c index 464d8fed..17a0060e 100644 --- a/apps/restconf/restconf_main.c +++ b/apps/restconf/restconf_main.c @@ -205,9 +205,8 @@ request_process(clicon_handle h, if (strcmp(method, "data") == 0) /* restconf, skip /api/data */ retval = api_data(h, r, path, pcvec, 2, qvec, data); - else - if (strcmp(method, "operations") == 0) /* rpc */ - retval = api_operations(h, r, path, pcvec, 2, qvec, data); + else if (strcmp(method, "operations") == 0) /* rpc */ + retval = api_operations(h, r, path, pcvec, 2, qvec, data); else if (strcmp(method, "test") == 0) retval = test(r, 0); else diff --git a/apps/restconf/restconf_methods.c b/apps/restconf/restconf_methods.c index 27989928..84da6b32 100644 --- a/apps/restconf/restconf_methods.c +++ b/apps/restconf/restconf_methods.c @@ -691,13 +691,12 @@ api_operation_post(clicon_handle h, char *media_accept; int use_xml = 0; /* By default return JSON */ - clicon_debug(1, "%s json:\"%s\"", __FUNCTION__, data); - media_accept = FCGX_GetParam("HTTP_ACCEPT", r->envp); - if (strcmp(media_accept, "application/yang-data+xml")==0) + clicon_debug(1, "%s json:\"%s\" path:\"%s\"", __FUNCTION__, data, path); + if ((media_accept = FCGX_GetParam("HTTP_ACCEPT", r->envp)) && + strcmp(media_accept, "application/yang-data+xml")==0) use_xml++; - - media_content_type = FCGX_GetParam("HTTP_CONTENT_TYPE", r->envp); - if (strcmp(media_content_type, "application/yang-data+xml")==0) + if ((media_content_type = FCGX_GetParam("HTTP_CONTENT_TYPE", r->envp)) && + strcmp(media_content_type, "application/yang-data+xml")==0) parse_xml++; clicon_debug(1, "%s accept:\"%s\" content-type:\"%s\"", __FUNCTION__, media_accept, media_content_type); diff --git a/lib/src/clixon_yang.c b/lib/src/clixon_yang.c index 5bc67c62..c6ee54ef 100644 --- a/lib/src/clixon_yang.c +++ b/lib/src/clixon_yang.c @@ -1779,7 +1779,7 @@ schema_nodeid_vec(yang_node *yn, } } if (!match){ - clicon_debug(1, "%s not found", nodeid); + clicon_debug(1, "%s: %s not found", __FUNCTION__, nodeid); goto ok; } ynext = (yang_node*)ys; diff --git a/test/test_restconf.sh b/test/test_restconf.sh index 83c4d875..ec733af8 100755 --- a/test/test_restconf.sh +++ b/test/test_restconf.sh @@ -83,7 +83,7 @@ new "restconf get subtree" expectfn "curl -sS -G http://localhost/restconf/data" '{"interfaces": {"interface": {"name": "eth/0/0","type": "eth","enabled": "true"}}} $' -new "restconf rpc using POST json" +new "restconf operation rpc using POST json" expectfn 'curl -sS -X POST -d {"input":{"routing-instance-name":"ipv4"}} http://localhost/restconf/operations/rt:fib-route' '{ "output": { "route": { "address-family": "ipv4", "next-hop": { "next-hop-list": "2.3.4.5" } } } } ' new "restconf rpc using POST xml"