mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
Use err from getting chunk length
This commit is contained in:
parent
ddd5e345ac
commit
b5b4047241
1 changed files with 6 additions and 0 deletions
|
@ -117,6 +117,12 @@ std::shared_ptr<HttpContainer> HttpRequestIDF::start(std::string url, std::strin
|
||||||
ESP_LOGV(TAG, "HTTP Response is chunked");
|
ESP_LOGV(TAG, "HTTP Response is chunked");
|
||||||
int length = 0;
|
int length = 0;
|
||||||
err = esp_http_client_get_chunk_length(client, &length);
|
err = esp_http_client_get_chunk_length(client, &length);
|
||||||
|
if (err != ESP_OK) {
|
||||||
|
this->status_momentary_error("failed", 1000);
|
||||||
|
ESP_LOGE(TAG, "Failed to get chunk length: %s", esp_err_to_name(err));
|
||||||
|
esp_http_client_cleanup(client);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
container->content_length = length;
|
container->content_length = length;
|
||||||
}
|
}
|
||||||
const auto status_code = esp_http_client_get_status_code(client);
|
const auto status_code = esp_http_client_get_status_code(client);
|
||||||
|
|
Loading…
Reference in a new issue