esp_http_client: add esp_http_client_set_authtype function

Since currently there are APIs to set url/username/password, it would be
good to also allow setting authtype.

Link: https://github.com/espressif/esp-idf/issues/4444
Closes https://github.com/espressif/esp-idf/pull/4454
Signed-off-by: Axel Lin <axel.lin@gmail.com>
pull/4494/head
Axel Lin 2019-12-06 15:13:10 +08:00 zatwierdzone przez Mahavir Jain
rodzic 6fdc8d7f92
commit 489c815eb8
2 zmienionych plików z 22 dodań i 0 usunięć

Wyświetl plik

@ -331,6 +331,16 @@ esp_err_t esp_http_client_set_password(esp_http_client_handle_t client, char *pa
return ESP_OK;
}
esp_err_t esp_http_client_set_authtype(esp_http_client_handle_t client, esp_http_client_auth_type_t auth_type)
{
if (client == NULL) {
ESP_LOGE(TAG, "client must not be NULL");
return ESP_ERR_INVALID_ARG;
}
client->connection_info.auth_type = auth_type;
return ESP_OK;
}
static esp_err_t _set_config(esp_http_client_handle_t client, const esp_http_client_config_t *config)
{
client->connection_info.method = config->method;

Wyświetl plik

@ -307,6 +307,18 @@ esp_err_t esp_http_client_get_password(esp_http_client_handle_t client, char **v
*/
esp_err_t esp_http_client_set_password(esp_http_client_handle_t client, char *password);
/**
* @brief Set http request auth_type.
*
* @param[in] client The esp_http_client handle
* @param[in] auth_type The esp_http_client auth type
*
* @return
* - ESP_OK
* - ESP_ERR_INVALID_ARG
*/
esp_err_t esp_http_client_set_authtype(esp_http_client_handle_t client, esp_http_client_auth_type_t auth_type);
/**
* @brief Set http request method
*