aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-10-25 20:09:23 +0100
committerChristian Grothoff <christian@grothoff.org>2020-10-25 20:09:23 +0100
commit429456b3188d0b0828b557553107ddfa83e8aa81 (patch)
treed568c9901b0601cd55c3a9d90f32cbf2c99dfbc8
parent2771e50ebee0aba9d4bf701a580d099372627e0f (diff)
use better status codes
-rw-r--r--src/backend/taler-merchant-httpd_private-post-instances.c2
-rw-r--r--src/backend/taler-merchant-httpd_private-post-orders.c4
-rw-r--r--src/lib/merchant_api_get_product.c4
-rw-r--r--src/lib/merchant_api_post_instances.c2
-rw-r--r--src/testing/test_merchant_api.c4
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
index f703506e..1a9d2b27 100644
--- 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
index 82e5e6c3..840cc076 100644
--- 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
index 076a694a..02560761 100644
--- 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
index 503e31ce..7b19c25b 100644
--- 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
index 790bee43..c7348e84 100644
--- 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",