Merge branch 'feature/support_api_set_http_timeout' into 'master'

esp_http_client: Add API to set http client timeout value

Closes IDFGH-5211

See merge request espressif/esp-idf!13446
This commit is contained in:
Mahavir Jain 2021-05-07 04:46:40 +00:00
commit 5aa6e4196c
2 changed files with 22 additions and 0 deletions

View File

@ -906,6 +906,16 @@ esp_err_t esp_http_client_set_method(esp_http_client_handle_t client, esp_http_c
return ESP_OK;
}
esp_err_t esp_http_client_set_timeout_ms(esp_http_client_handle_t client, int timeout_ms)
{
if (client == NULL) {
return ESP_ERR_INVALID_ARG;
}
client->timeout_ms = timeout_ms;
return ESP_OK;
}
static int esp_http_client_get_data(esp_http_client_handle_t client)
{
if (client->state < HTTP_STATE_RES_COMPLETE_HEADER) {

View File

@ -360,6 +360,18 @@ esp_err_t esp_http_client_set_authtype(esp_http_client_handle_t client, esp_http
*/
esp_err_t esp_http_client_set_method(esp_http_client_handle_t client, esp_http_client_method_t method);
/**
* @brief Set http request timeout
*
* @param[in] client The esp_http_client handle
* @param[in] timeout_ms The timeout value
*
* @return
* - ESP_OK
* - ESP_ERR_INVALID_ARG
*/
esp_err_t esp_http_client_set_timeout_ms(esp_http_client_handle_t client, int timeout_ms);
/**
* @brief Delete http request header
*