From 1954f2dee9545c89012dc3215769f044f323dc92 Mon Sep 17 00:00:00 2001 From: priscilla Date: Wed, 15 Feb 2023 09:54:34 -0500 Subject: check the pending webhook with web server, test of web server is ok --- src/testing/testing_api_cmd_testserver.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/testing/testing_api_cmd_testserver.c') diff --git a/src/testing/testing_api_cmd_testserver.c b/src/testing/testing_api_cmd_testserver.c index 7992c6f1..d06ce824 100644 --- a/src/testing/testing_api_cmd_testserver.c +++ b/src/testing/testing_api_cmd_testserver.c @@ -73,7 +73,7 @@ struct RequestCtx /** * body of the webhook. */ - void *body; + char *body; /** * size of the body @@ -142,7 +142,8 @@ handler_cb (void *cls, if (NULL == rc) { const char *hdr; - rc= GNUNET_new (struct RequestCtx); + + rc = GNUNET_new (struct RequestCtx); *con_cls = rc; rc->http_method = GNUNET_strdup (method); hdr = MHD_lookup_connection_value (connection, @@ -150,11 +151,13 @@ handler_cb (void *cls, "Taler-test-header"); if (NULL != hdr) rc->header = GNUNET_strdup (hdr); + if (NULL != hdr) + rc->url = GNUNET_strdup (url); GNUNET_array_append (ts->rcs, ts->rcs_length, rc); fprintf (stderr, - "Webhook called server at %s with header %s\n", + "Webhook called server at `%s' with header `%s'\n", url, hdr); return MHD_YES; @@ -178,8 +181,11 @@ handler_cb (void *cls, } if (0 != *upload_data_size) { - rc->body = &upload_data; + rc->body = GNUNET_strdup(upload_data); *upload_data_size = 0; + GNUNET_array_append (ts->rcs, + ts->rcs_length, + rc); return MHD_YES; } body = GNUNET_JSON_PACK ( @@ -253,13 +259,14 @@ testserver_cleanup (void *cls, struct TestserverState *ser = cls; (void) cmd; - for (unsigned int i=0;ircs_length;i++) + for (unsigned int i=0;ircs_length-1;i++) { struct RequestCtx *rc = ser->rcs[i]; GNUNET_free (rc->url); GNUNET_free (rc->http_method); GNUNET_free (rc->header); + GNUNET_free (rc->body); GNUNET_free (rc); } GNUNET_array_grow (ser->rcs, @@ -294,6 +301,9 @@ traits_testserver (void *cls, TALER_TESTING_make_trait_http_body (index, &rc->body), TALER_TESTING_trait_end (), }; + + fprintf (stdout, "\n\nbody %s\n\n", rc->body); + return TALER_TESTING_get_trait (traits, ret, trait, -- cgit v1.2.3