summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-09-01 20:35:47 +0200
committerFlorian Dold <florian.dold@gmail.com>2019-09-01 20:35:47 +0200
commit50583b73f0b69bb2a76044bcd13669aefb7cc057 (patch)
treeab6f534a4722aefe0ab548471bc9791ca54be86d
parentc9089497999cb17da4dd90c05ad1c916141bb285 (diff)
downloadmerchant-50583b73f0b69bb2a76044bcd13669aefb7cc057.tar.gz
merchant-50583b73f0b69bb2a76044bcd13669aefb7cc057.tar.bz2
merchant-50583b73f0b69bb2a76044bcd13669aefb7cc057.zip
wrap array in JSON object
-rw-r--r--src/backend/taler-merchant-httpd_history.c7
-rw-r--r--src/lib/testing_api_cmd_history.c7
2 files changed, 8 insertions, 6 deletions
diff --git a/src/backend/taler-merchant-httpd_history.c b/src/backend/taler-merchant-httpd_history.c
index 73236cb2..c9674e86 100644
--- a/src/backend/taler-merchant-httpd_history.c
+++ b/src/backend/taler-merchant-httpd_history.c
@@ -291,9 +291,10 @@ MH_handler_history (struct TMH_RequestHandler *rh,
TALER_EC_HISTORY_DB_FETCH_ERROR,
"db error to get history");
}
- ret = TMH_RESPONSE_reply_json (connection,
- response,
- MHD_HTTP_OK);
+ ret = TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK,
+ "{ s:o }",
+ "history",
+ response);
LOG_INFO ("/history, http code: %d\n",
MHD_HTTP_OK);
json_decref (response);
diff --git a/src/lib/testing_api_cmd_history.c b/src/lib/testing_api_cmd_history.c
index 68c1e257..c9792680 100644
--- a/src/lib/testing_api_cmd_history.c
+++ b/src/lib/testing_api_cmd_history.c
@@ -164,10 +164,10 @@ history_cb (void *cls,
unsigned int nresult;
struct GNUNET_TIME_Absolute last_timestamp;
struct GNUNET_TIME_Absolute entry_timestamp;
+ json_t *arr;
hs->ho = NULL;
-
if (hs->http_status != http_status)
TALER_TESTING_FAIL (hs->is);
@@ -179,7 +179,8 @@ history_cb (void *cls,
return;
}
- nresult = json_array_size (json);
+ arr = json_object_get (json, "history");
+ nresult = json_array_size (arr);
if (hs->nresult != nresult)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -196,7 +197,7 @@ history_cb (void *cls,
{
json_t *entry;
size_t index;
- json_array_foreach (json, index, entry)
+ json_array_foreach (arr, index, entry)
{
json_t *timestamp;