diff options
Diffstat (limited to 'src/lib/merchant_api_get_products.c')
-rw-r--r-- | src/lib/merchant_api_get_products.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/lib/merchant_api_get_products.c b/src/lib/merchant_api_get_products.c index 98976237..01115094 100644 --- a/src/lib/merchant_api_get_products.c +++ b/src/lib/merchant_api_get_products.c @@ -149,10 +149,10 @@ handle_get_products_finished (void *cls, { case MHD_HTTP_OK: { - json_t *products; + const json_t *products; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_json ("products", - &products), + GNUNET_JSON_spec_array_const ("products", + &products), GNUNET_JSON_spec_end () }; @@ -163,26 +163,18 @@ handle_get_products_finished (void *cls, { gpr.hr.http_status = 0; gpr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; + break; } - else + if (GNUNET_OK == + parse_products (json, + products, + pgh)) { - if ( (! json_is_array (products)) || - (GNUNET_OK == - parse_products (json, - products, - pgh)) ) - { - GNUNET_JSON_parse_free (spec); - TALER_MERCHANT_products_get_cancel (pgh); - return; - } - else - { - gpr.hr.http_status = 0; - gpr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; - } + TALER_MERCHANT_products_get_cancel (pgh); + return; } - GNUNET_JSON_parse_free (spec); + gpr.hr.http_status = 0; + gpr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; } case MHD_HTTP_UNAUTHORIZED: |