Respond to POST request outside of URI handler

TeaElse
Posts: 9
Joined: Mon Feb 18, 2019 10:11 am

Respond to POST request outside of URI handler

Postby TeaElse » Wed Feb 27, 2019 9:10 am

Hello,

I want to combine the simple wifi example with UART Communication:
1. I get a POST Request
2. Data from that request is parsed and sent to an external device over UART connection.
3. The external device responds with an answer.
4. I forward the answer as a response to the still open POST request.

To do this I have a post handler and a uart handler (basically just combined the uart_events example with the simple_wifi example).
The problem is that I dont know how to respond to the request.

It works when I do a httpd_resp_send() within the post handler right after receiving the POST request.
But I can't do that from the uart event handler.
If I understand correctly that is because the HTTP Request Data Structure(httpd_req_t) is only valid within the URI handler.

How could I make this work?
I appreciate any hints!


Many thanks!

Who is online

Users browsing this forum: No registered users and 126 guests