diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd_responses.h')
-rw-r--r-- | src/backend/taler-merchant-httpd_responses.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/backend/taler-merchant-httpd_responses.h b/src/backend/taler-merchant-httpd_responses.h index ad063eb8..7240d601 100644 --- a/src/backend/taler-merchant-httpd_responses.h +++ b/src/backend/taler-merchant-httpd_responses.h @@ -31,6 +31,16 @@ #include <pthread.h> /** + * Make JSON response object. + * + * @param json the json object + * @return MHD response object + */ +struct MHD_Response * +TMH_RESPONSE_make_json (const json_t *json); + + +/** * Send JSON object as response. * * @param connection the MHD connection @@ -45,6 +55,18 @@ TMH_RESPONSE_reply_json (struct MHD_Connection *connection, /** + * Make JSON response object. + * + * @param fmt format string for pack + * @param ... varargs + * @return MHD response object + */ +struct MHD_Response * +TMH_RESPONSE_make_json_pack (const char *fmt, + ...); + + +/** * Function to call to handle the request by building a JSON * reply from a format string and varargs. * @@ -70,6 +92,7 @@ TMH_RESPONSE_reply_json_pack (struct MHD_Connection *connection, int TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection); + /** * Send a response indicating an internal error. * @@ -80,6 +103,18 @@ TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection); int TMH_RESPONSE_reply_internal_error (struct MHD_Connection *connection, const char *hint); + + +/** + * Create a response indicating an internal error. + * + * @param hint hint about the internal error's nature + * @return a MHD response object + */ +struct MHD_Response * +TMH_RESPONSE_make_internal_error (const char *hint); + + /** * Send a response indicating an external error. * @@ -90,6 +125,18 @@ TMH_RESPONSE_reply_internal_error (struct MHD_Connection *connection, int TMH_RESPONSE_reply_external_error (struct MHD_Connection *connection, const char *hint); + + +/** + * Create a response indicating an external error. + * + * @param hint hint about the internal error's nature + * @return a MHD response object + */ +struct MHD_Response * +TMH_RESPONSE_make_external_error (const char *hint); + + /** * Send a response indicating that the request was too big. * @@ -99,6 +146,7 @@ TMH_RESPONSE_reply_external_error (struct MHD_Connection *connection, int TMH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection); + /** * Add headers we want to return in every response. * Useful for testing, like if we want to always close |