From d0cfaaf060a07eeb18ed9131fa8ea627884ad9f8 Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 17 Mar 2006 17:25:51 +0000 Subject: [PATCH] formatting errors as JSON strings so they come accross as, well, JSON :) git-svn-id: svn://svn.open-ils.org/ILS/trunk@3387 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- OpenSRF/src/gateway/osrf_json_gateway.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/OpenSRF/src/gateway/osrf_json_gateway.c b/OpenSRF/src/gateway/osrf_json_gateway.c index 1180048f8d..a6a46313e0 100644 --- a/OpenSRF/src/gateway/osrf_json_gateway.c +++ b/OpenSRF/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); -- 2.43.2