Unclear instructions on how to use esp_http_client (http_event_handler mandatory?)
Posted: Tue Feb 25, 2020 8:09 pm
Hello,
I've looked up the esp_http_client examples (https://github.com/espressif/esp-idf/tr ... ttp_client).
But there's no single example showing on how to get the response body of a request.
My understanding for now is, that you have to register a "_http_event_handler" and work on the "HTTP_EVENT_ON_DATA" event to receive the (maybe chunked) body of a response.
Would it also be possible to work without said handler? I don't like to maintain a "global" variable that holds the current response body.
I've also tried the "esp_http_client_read" function, which works fine for non chunked responses. But I couldn't figure out how to handle chunked responses correctly when using "esp_http_client_read" with "esp_http_client_fetch_headers" etc.
Would be great if there was a function like "esp_http_client_perform" that also gives u the response body.
So basically my question is: Is the "_http_event_handler" mandatory when working with (chunked) responses?
Thanks.
I've looked up the esp_http_client examples (https://github.com/espressif/esp-idf/tr ... ttp_client).
But there's no single example showing on how to get the response body of a request.
My understanding for now is, that you have to register a "_http_event_handler" and work on the "HTTP_EVENT_ON_DATA" event to receive the (maybe chunked) body of a response.
Would it also be possible to work without said handler? I don't like to maintain a "global" variable that holds the current response body.
I've also tried the "esp_http_client_read" function, which works fine for non chunked responses. But I couldn't figure out how to handle chunked responses correctly when using "esp_http_client_read" with "esp_http_client_fetch_headers" etc.
Would be great if there was a function like "esp_http_client_perform" that also gives u the response body.
So basically my question is: Is the "_http_event_handler" mandatory when working with (chunked) responses?
Thanks.