mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
Merge branch 'contrib/github_pr_14512' into 'master'
feat(esp_http_client): Add function to delete all headers set by 'esp_http_client_set_header' (GitHub PR) Closes IDFGH-13628 See merge request espressif/esp-idf!33814
This commit is contained in:
commit
72f3ef8469
@ -356,19 +356,40 @@ static int http_on_chunk_header(http_parser *parser)
|
||||
|
||||
esp_err_t esp_http_client_set_header(esp_http_client_handle_t client, const char *key, const char *value)
|
||||
{
|
||||
if (client == NULL || client->request == NULL || client->request->headers == NULL || key == NULL || value == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return http_header_set(client->request->headers, key, value);
|
||||
}
|
||||
|
||||
esp_err_t esp_http_client_get_header(esp_http_client_handle_t client, const char *key, char **value)
|
||||
{
|
||||
if (client == NULL || client->request == NULL || client->request->headers == NULL || key == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return http_header_get(client->request->headers, key, value);
|
||||
}
|
||||
|
||||
esp_err_t esp_http_client_delete_header(esp_http_client_handle_t client, const char *key)
|
||||
{
|
||||
if (client == NULL || client->request == NULL || client->request->headers == NULL || key == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return http_header_delete(client->request->headers, key);
|
||||
}
|
||||
|
||||
esp_err_t esp_http_client_delete_all_headers(esp_http_client_handle_t client)
|
||||
{
|
||||
if (client == NULL || client->request == NULL || client->request->headers == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return http_header_clean(client->request->headers);
|
||||
}
|
||||
|
||||
esp_err_t esp_http_client_get_username(esp_http_client_handle_t client, char **value)
|
||||
{
|
||||
if (client == NULL || value == NULL) {
|
||||
|
@ -487,6 +487,17 @@ esp_err_t esp_http_client_set_timeout_ms(esp_http_client_handle_t client, int ti
|
||||
*/
|
||||
esp_err_t esp_http_client_delete_header(esp_http_client_handle_t client, const char *key);
|
||||
|
||||
/**
|
||||
* @brief Delete all http request headers
|
||||
*
|
||||
* @param[in] client The esp_http_client handle
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK
|
||||
* - ESP_FAIL
|
||||
*/
|
||||
esp_err_t esp_http_client_delete_all_headers(esp_http_client_handle_t client);
|
||||
|
||||
/**
|
||||
* @brief This function will be open the connection, write all header strings and return
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user