From: erickson Date: Fri, 17 Mar 2006 17:25:51 +0000 (+0000) Subject: formatting errors as JSON strings so they come accross as, well, JSON :) X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=bcb96292cf26b46f10bfa0ba18054028b830590c;p=working%2FOpenSRF.git formatting errors as JSON strings so they come accross as, well, JSON :) git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@665 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/gateway/osrf_json_gateway.c b/src/gateway/osrf_json_gateway.c index 1180048..a6a4631 100644 --- a/src/gateway/osrf_json_gateway.c +++ b/src/gateway/osrf_json_gateway.c @@ -86,7 +86,7 @@ static int osrf_json_gateway_method_handler (request_rec *r) { service = apacheGetFirstParamValue( params, "service" ); method = apacheGetFirstParamValue( params, "method" ); format = apacheGetFirstParamValue( params, "format" ); - a_l = apacheGetFirstParamValue( params, "api_level" ); + a_l = apacheGetFirstParamValue( params, "api_level" ); mparams = apacheGetParamValues( params, "param" ); /* free me */ if (a_l) @@ -166,8 +166,16 @@ static int osrf_json_gateway_method_handler (request_rec *r) { if (isXML) snprintf( buf, l, "\"%s : %s\"", statusname, statustext ); - else - snprintf( buf, l, ",\"debug\":\"%s : %s\"", statusname, statustext ); + else { + char bb[l]; + bzero(bb, l); + snprintf(bb, l, "%s : %s", statusname, statustext); + jsonObject* tmp = jsonNewObject(bb); + char* j = jsonObjectToJSON(tmp); + snprintf( buf, l, ",\"debug\": %s", j); + free(j); + jsonObjectFree(tmp); + } ap_rputs(buf, r);