commit 429456b3188d0b0828b557553107ddfa83e8aa81 parent 2771e50ebee0aba9d4bf701a580d099372627e0f Author: Christian Grothoff <christian@grothoff.org> Date: Sun, 25 Oct 2020 20:09:23 +0100 use better status codes Diffstat:
5 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c b/src/backend/taler-merchant-httpd_private-post-instances.c @@ -188,7 +188,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, + MHD_HTTP_CONFLICT, TALER_EC_POST_INSTANCES_BAD_CURRENCY, NULL); } diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c @@ -385,7 +385,7 @@ execute_order (struct MHD_Connection *connection, GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error ( connection, - MHD_HTTP_BAD_REQUEST, + MHD_HTTP_CONFLICT, TALER_EC_PROPOSAL_ORDER_BAD_CURRENCY, TMH_currency); } @@ -464,7 +464,7 @@ execute_order (struct MHD_Connection *connection, MHD_RESULT ret; ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, /* or conflict? */ + MHD_HTTP_CONFLICT, TALER_EC_PROPOSAL_STORE_DB_ERROR_ALREADY_EXISTS, order_id); GNUNET_JSON_parse_free (spec); diff --git a/src/lib/merchant_api_get_product.c b/src/lib/merchant_api_get_product.c @@ -173,6 +173,10 @@ handle_get_product_finished (void *cls, GNUNET_JSON_parse_free (spec); break; } + case MHD_HTTP_NOT_FOUND: + hr.ec = TALER_JSON_get_error_code (json); + hr.hint = TALER_JSON_get_error_hint (json); + break; default: /* unexpected response code */ hr.ec = TALER_JSON_get_error_code (json); diff --git a/src/lib/merchant_api_post_instances.c b/src/lib/merchant_api_post_instances.c @@ -93,7 +93,7 @@ handle_post_instances_finished (void *cls, iph->job = NULL; GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "POST /instances completed with response code %u\n", + "POST /private/instances completed with response code %u\n", (unsigned int) response_code); switch (response_code) { diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c @@ -328,7 +328,7 @@ run (void *cls, NULL), TALER_TESTING_cmd_merchant_post_orders ("create-proposal-1-pre-exists", merchant_url, - MHD_HTTP_BAD_REQUEST, + MHD_HTTP_CONFLICT, "1", GNUNET_TIME_UNIT_ZERO_ABS, GNUNET_TIME_UNIT_FOREVER_ABS, @@ -1241,7 +1241,7 @@ run (void *cls, "i2", PAYTO_I1, "USD", - MHD_HTTP_BAD_REQUEST), + MHD_HTTP_CONFLICT), TALER_TESTING_cmd_merchant_post_instances ("instance-create-i2", merchant_url, "i2",