Page 1 of 1

Get esp_http_client_config_t from esp_http_client_handle_t?

Posted: Tue Nov 29, 2022 12:00 pm
by A6ESPF
Is it possible to get the client configuration from the client handle after the client is initialized?
For example:

Code: Select all

char name[] = "example";
esp_http_client_config_t cfg =
{
    .host = "httpbin.org",
    .path = "/get",
    .method = HTTP_METHOD_GET,
    .user_data = name,
}
esp_http_client_handle_t cli = esp_http_client_init(&cfg);
Now, is it possible to access the client configuration in another function, something like this:

Code: Select all

esp_http_client_config_t* cfg = esp_http_get_client_config(cli);
More specifically, I'd like to access user_data field in the configuration.

Re: Get esp_http_client_config_t from esp_http_client_handle_t?

Posted: Wed Nov 30, 2022 7:57 am
by ESP_YJM
Sorry, there is no interface you want to get cfg, but you can get user_data here https://github.com/espressif/esp-idf/bl ... mple.c#L73

Re: Get esp_http_client_config_t from esp_http_client_handle_t?

Posted: Wed Nov 30, 2022 8:11 am
by A6ESPF
I see. Regarding user_data, is it possible to access it prior to http client perform function?

Re: Get esp_http_client_config_t from esp_http_client_handle_t?

Posted: Thu Dec 01, 2022 7:05 am
by ESP_YJM
No, No API to access this user_data. You can search the esp_http_client.c file to check user_data.