From f4a58f964dc53c139ac30b8da8ffa93e838590af Mon Sep 17 00:00:00 2001 From: jospaeth Date: Wed, 9 Sep 2020 21:21:37 +0200 Subject: fix response code for error case --- src/escrow/plugin_rest_escrow.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/escrow/plugin_rest_escrow.c b/src/escrow/plugin_rest_escrow.c index 917d0cdca..c5c4dbaf8 100644 --- a/src/escrow/plugin_rest_escrow.c +++ b/src/escrow/plugin_rest_escrow.c @@ -417,6 +417,7 @@ get_user_secret_from_payload (struct RequestHandle *handle) if (0 >= handle->data_size) { handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_NO_DATA); + handle->response_code = MHD_HTTP_BAD_REQUEST; GNUNET_SCHEDULER_add_now (&do_error, handle); return NULL; } @@ -427,6 +428,7 @@ get_user_secret_from_payload (struct RequestHandle *handle) if (NULL == json_data) { handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_NO_DATA); + handle->response_code = MHD_HTTP_BAD_REQUEST; GNUNET_SCHEDULER_add_now (&do_error, handle); json_decref (json_data); return NULL; @@ -439,6 +441,7 @@ get_user_secret_from_payload (struct RequestHandle *handle) if (0 != json_unpack_state) { handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID); + handle->response_code = MHD_HTTP_BAD_REQUEST; GNUNET_SCHEDULER_add_now (&do_error, handle); json_decref (json_data); return NULL; @@ -447,6 +450,7 @@ get_user_secret_from_payload (struct RequestHandle *handle) if (NULL == user_secret) { handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID); + handle->response_code = MHD_HTTP_BAD_REQUEST; GNUNET_SCHEDULER_add_now (&do_error, handle); json_decref (json_data); return NULL; @@ -455,6 +459,7 @@ get_user_secret_from_payload (struct RequestHandle *handle) { json_decref (json_data); handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID); + handle->response_code = MHD_HTTP_BAD_REQUEST; GNUNET_SCHEDULER_add_now (&do_error, handle); return NULL; } @@ -601,6 +606,7 @@ get_anchor_from_payload (struct RequestHandle *handle) if (0 >= handle->data_size) { handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_NO_DATA); + handle->response_code = MHD_HTTP_BAD_REQUEST; GNUNET_SCHEDULER_add_now (&do_error, handle); return NULL; } @@ -611,6 +617,7 @@ get_anchor_from_payload (struct RequestHandle *handle) if (NULL == json_data) { handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_NO_DATA); + handle->response_code = MHD_HTTP_BAD_REQUEST; GNUNET_SCHEDULER_add_now (&do_error, handle); json_decref (json_data); return NULL; @@ -623,6 +630,7 @@ get_anchor_from_payload (struct RequestHandle *handle) if (0 != json_unpack_state) { handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID); + handle->response_code = MHD_HTTP_BAD_REQUEST; GNUNET_SCHEDULER_add_now (&do_error, handle); json_decref (json_data); return NULL; @@ -631,6 +639,7 @@ get_anchor_from_payload (struct RequestHandle *handle) if (NULL == anchor_string) { handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID); + handle->response_code = MHD_HTTP_BAD_REQUEST; GNUNET_SCHEDULER_add_now (&do_error, handle); json_decref (json_data); return NULL; @@ -639,6 +648,7 @@ get_anchor_from_payload (struct RequestHandle *handle) { json_decref (json_data); handle->emsg = GNUNET_strdup (GNUNET_REST_ERROR_DATA_INVALID); + handle->response_code = MHD_HTTP_BAD_REQUEST; GNUNET_SCHEDULER_add_now (&do_error, handle); return NULL; } -- cgit v1.2.3