Skip to content

Commit

Permalink
feat(esp_http_client): Add function to delete all headers set by 'esp…
Browse files Browse the repository at this point in the history
…_http_client_set_header'
  • Loading branch information
DCSBL committed Sep 5, 2024
1 parent 6673376 commit 050ef87
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions components/esp_http_client/esp_http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ esp_err_t esp_http_client_delete_header(esp_http_client_handle_t client, const c
return http_header_delete(client->request->headers, key);
}

esp_err_t esp_http_client_delete_headers(esp_http_client_handle_t client)
{
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) {
Expand Down
11 changes: 11 additions & 0 deletions components/esp_http_client/include/esp_http_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_headers(esp_http_client_handle_t client);

/**
* @brief This function will be open the connection, write all header strings and return
*
Expand Down

0 comments on commit 050ef87

Please sign in to comment.