summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-01-22 17:32:46 +0100
committerChristian Grothoff <christian@grothoff.org>2016-01-22 17:32:46 +0100
commitd6553966f11e24f8f86aa21c0ce3760b6e966006 (patch)
tree8b8beebffeebc5f921d071fb815eb9f40cab0e80
parente6432cd1ff4c66f1c3186c2acdb45b9cc1d599c5 (diff)
downloadexchange-d6553966f11e24f8f86aa21c0ce3760b6e966006.tar.gz
exchange-d6553966f11e24f8f86aa21c0ce3760b6e966006.tar.bz2
exchange-d6553966f11e24f8f86aa21c0ce3760b6e966006.zip
/wire/deposits expects to use GET, not POST
-rw-r--r--src/mint-lib/mint_api_wire_deposits.c36
-rw-r--r--src/mint-lib/test_mint_api.c2
2 files changed, 13 insertions, 25 deletions
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
@@ -49,11 +49,6 @@ struct TALER_MINT_WireDepositsHandle
char *url;
/**
- * JSON encoding of the request to POST.
- */
- char *json_enc;
-
- /**
* Handle for the request.
*/
struct MAC_Job *job;
@@ -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,35 +223,28 @@ 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,
&MAC_download_cb));
GNUNET_assert (CURLE_OK ==
@@ -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