diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd.c')
-rw-r--r-- | src/backend/taler-merchant-httpd.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c index 120475de..4a726ecc 100644 --- a/src/backend/taler-merchant-httpd.c +++ b/src/backend/taler-merchant-httpd.c @@ -1159,13 +1159,6 @@ url_handler (void *cls, NULL } }; - static struct TMH_RequestHandler h404 = { - .mime_type = "application/json", - .data = "{\"code\":10}", - .data_size = strlen ("{\"code\":10}"), - .handler = &TMH_MHD_handler_static_response, - .response_code = MHD_HTTP_NOT_FOUND - }; struct TMH_HandlerContext *hc = *con_cls; struct TMH_RequestHandler *handlers; bool use_private = false; @@ -1408,15 +1401,15 @@ url_handler (void *cls, } if ( (NULL == hc->rh) && (url_found) ) - return TALER_MHD_reply_json_pack (connection, - MHD_HTTP_METHOD_NOT_ALLOWED, - "{s:s}", - "error", - "method not allowed"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_METHOD_NOT_ALLOWED, + TALER_EC_METHOD_INVALID, + method); if (NULL == hc->rh) - return TMH_MHD_handler_static_response (&h404, - connection, - hc); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_ENDPOINT_UNKNOWN, + hc->url); } } /* At this point, we must have found a handler */ @@ -1426,7 +1419,7 @@ url_handler (void *cls, return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, TALER_EC_INSTANCE_UNKNOWN, - "merchant instance unknown"); + url); hc->has_body = ( (0 == strcasecmp (method, MHD_HTTP_METHOD_POST)) || (0 == strcasecmp (method, @@ -1461,7 +1454,7 @@ url_handler (void *cls, return TALER_MHD_reply_with_error (connection, MHD_HTTP_PAYLOAD_TOO_LARGE, TALER_EC_UPLOAD_EXCEEDS_LIMIT, - "upload exceeds limit"); + cl); } } GNUNET_break (NULL == hc->request_body); /* can't have it already */ |