How to know the incoming HTTP request

#1

Greetings to one and all,

Please help me regarding the below:

  1. My goal is: I want to know whether I am receiving an incoming HTTP request
  2. My actions are: I have registered the HTTP endpoint and handler for particular endpoint
  3. The result I see is: Handler which I have registered is not firing when I send the request.
  4. My expectation & question is: I want to know after sending the request what I am receiving in my code.

Here is my code snippet:

#include "mgos.h"

#include "mgos_http_server.h"

#include "mongoose.h"

struct mg_connection *c;

static void foo_handler(struct mg_connection *c, int ev, void *p,

                        void *user_data)

{

   (void) p;

  if (ev != MG_EV_HTTP_REQUEST) return;

  LOG(LL_INFO, ("Foo requested"));

  mg_send_response_line(c, 200,

                        "Content-Type: text/html\r\n");

  mg_printf(c, "%s\r\n", "Fooooo");

  c->flags |= (MG_F_SEND_AND_CLOSE);

  (void) user_data;

}

enum mgos_app_init_result mgos_app_init(void)

{

  mgos_register_http_endpoint("/foo/", foo_handler, NULL);

  return MGOS_APP_INIT_SUCCESS;

}
#2

The code looks ok. There is no reason to not work.
How did you test?