Skip to content

Commit

Permalink
fix(http): fix invalid content-length header in http get
Browse files Browse the repository at this point in the history
  • Loading branch information
TeXniKK committed Aug 28, 2024
1 parent c9df77e commit 1b46f91
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/esp_http_client/esp_http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,9 @@ static esp_err_t esp_http_client_connect(esp_http_client_handle_t client)
static int http_client_prepare_first_line(esp_http_client_handle_t client, int write_len)
{
if (write_len >= 0) {
http_header_set_format(client->request->headers, "Content-Length", "%d", write_len);
if (client->connection_info.method != HTTP_METHOD_GET) {
http_header_set_format(client->request->headers, "Content-Length", "%d", write_len);
}
} else {
esp_http_client_set_header(client, "Transfer-Encoding", "chunked");
}
Expand Down

0 comments on commit 1b46f91

Please sign in to comment.