From d6553966f11e24f8f86aa21c0ce3760b6e966006 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 22 Jan 2016 17:32:46 +0100 Subject: /wire/deposits expects to use GET, not POST --- src/mint-lib/mint_api_wire_deposits.c | 36 ++++++++++++----------------------- src/mint-lib/test_mint_api.c | 2 +- 2 files changed, 13 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/mint-lib/mint_api_wire_deposits.c b/src/mint-lib/mint_api_wire_deposits.c index 6fd4d75d7..f71c5b696 100644 --- a/src/mint-lib/mint_api_wire_deposits.c +++ b/src/mint-lib/mint_api_wire_deposits.c @@ -48,11 +48,6 @@ struct TALER_MINT_WireDepositsHandle */ char *url; - /** - * JSON encoding of the request to POST. - */ - char *json_enc; - /** * Handle for the request. */ @@ -217,7 +212,8 @@ TALER_MINT_wire_deposits (struct TALER_MINT_Handle *mint, { struct TALER_MINT_WireDepositsHandle *wdh; struct TALER_MINT_Context *ctx; - json_t *wdh_obj; + char *buf; + char *path; CURL *eh; if (GNUNET_YES != @@ -227,33 +223,26 @@ TALER_MINT_wire_deposits (struct TALER_MINT_Handle *mint, return NULL; } - wdh_obj = json_pack ("{s:o}", - "wtid", TALER_json_from_data (wtid, - sizeof (struct TALER_WireTransferIdentifierRawP))); - wdh = GNUNET_new (struct TALER_MINT_WireDepositsHandle); wdh->mint = mint; wdh->cb = cb; wdh->cb_cls = cb_cls; - wdh->url = MAH_path_to_url (mint, "/wire/deposits"); + + buf = GNUNET_STRINGS_data_to_string_alloc (wtid, + sizeof (struct TALER_WireTransferIdentifierRawP)); + GNUNET_asprintf (&path, + "/wire/deposits?wtid=%s", + buf); + wdh->url = MAH_path_to_url (wdh->mint, + path); + GNUNET_free (buf); + GNUNET_free (path); eh = curl_easy_init (); - GNUNET_assert (NULL != (wdh->json_enc = - json_dumps (wdh_obj, - JSON_COMPACT))); - json_decref (wdh_obj); GNUNET_assert (CURLE_OK == curl_easy_setopt (eh, CURLOPT_URL, wdh->url)); - GNUNET_assert (CURLE_OK == - curl_easy_setopt (eh, - CURLOPT_POSTFIELDS, - wdh->json_enc)); - GNUNET_assert (CURLE_OK == - curl_easy_setopt (eh, - CURLOPT_POSTFIELDSIZE, - strlen (wdh->json_enc))); GNUNET_assert (CURLE_OK == curl_easy_setopt (eh, CURLOPT_WRITEFUNCTION, @@ -288,7 +277,6 @@ TALER_MINT_wire_deposits_cancel (struct TALER_MINT_WireDepositsHandle *wdh) } GNUNET_free_non_null (wdh->db.buf); GNUNET_free (wdh->url); - GNUNET_free (wdh->json_enc); GNUNET_free (wdh); } diff --git a/src/mint-lib/test_mint_api.c b/src/mint-lib/test_mint_api.c index 60ef8c78a..e41d01805 100644 --- a/src/mint-lib/test_mint_api.c +++ b/src/mint-lib/test_mint_api.c @@ -2510,7 +2510,7 @@ run (void *cls, the mint knows about the deposit, but has no WTID yet. */ { .oc = OC_DEPOSIT_WTID, .label = "deposit-wtid-found", - .expected_response_code = MHD_HTTP_FOUND, + .expected_response_code = MHD_HTTP_ACCEPTED, .details.deposit_wtid.deposit_ref = "deposit-simple" }, /* Try resolving a deposit's WTID for a failed deposit. As the deposit failed, the answer should be that -- cgit v1.2.3