aboutsummaryrefslogtreecommitdiff
path: root/src/bank-lib/fakebank.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-05-15 10:55:47 +0200
committerChristian Grothoff <christian@grothoff.org>2017-05-16 11:05:00 +0200
commitbe3b891dbd9b1532b9dca91629d478cc3933dfdc (patch)
tree485e1ee4e3c4e9cbd3dc5bdddbf59a77dbefa332 /src/bank-lib/fakebank.c
parentd3fac1856277e6a832c261f1820ed34a95301e1d (diff)
fix port numbers, no longer 8081 but on 8080; and box json array /history response in {data} as required by API
Diffstat (limited to 'src/bank-lib/fakebank.c')
-rw-r--r--src/bank-lib/fakebank.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index 0359b4a4b..fb5121687 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -411,6 +411,7 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
enum TALER_BANK_Direction direction;
struct Transaction *pos;
json_t *history;
+ json_t *jresponse;
int ret;
auth = MHD_lookup_connection_value (connection,
@@ -536,7 +537,6 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
count++;
}
}
-
if (0 == json_array_size (history))
{
struct MHD_Response *resp;
@@ -552,14 +552,23 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
return ret;
}
+ jresponse = json_pack ("{s:o}",
+ "data", history);
+ if (NULL == jresponse)
+ {
+ GNUNET_break (0);
+ return MHD_NO;
+ }
+
/* Finally build response object */
{
struct MHD_Response *resp;
void *json_str;
size_t json_len;
- json_str = json_dumps (history,
+ json_str = json_dumps (jresponse,
JSON_INDENT(2));
+ json_decref (jresponse);
if (NULL == json_str)
{
GNUNET_break (0);