mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-16 04:22:22 +00:00
feat(esp_http_client): Add API to set auth data
This new API can be used to set the authentication data in the client context when the auth data is received in the custom header Closes: https://github.com/espressif/esp-idf/pull/12131
This commit is contained in:
@@ -1645,6 +1645,15 @@ esp_http_client_transport_t esp_http_client_get_transport_type(esp_http_client_h
|
||||
}
|
||||
}
|
||||
|
||||
esp_err_t esp_http_client_set_auth_data(esp_http_client_handle_t client, const char *auth_data, int len)
|
||||
{
|
||||
if (client == NULL || auth_data == NULL || len <= 0) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
http_utils_append_string(&client->auth_header, auth_data, len);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
void esp_http_client_add_auth(esp_http_client_handle_t client)
|
||||
{
|
||||
if (client == NULL) {
|
||||
|
||||
Reference in New Issue
Block a user