[http_request] Reduce log level for missing header (#18932)

This commit is contained in:
guillempages
2026-10-05 06:55:55 +11:00
committed by GitHub
parent fb8f679be9
commit aad7907c37
2 changed files with 6 additions and 2 deletions
@@ -25,11 +25,10 @@ std::string HttpContainer::get_response_header(const std::string &header_name) {
auto lower = str_lower_case(header_name); // NOLINT
for (const auto &entry : this->response_headers_) {
if (entry.name == lower) {
ESP_LOGD(TAG, "Header with name %s found with value %s", lower.c_str(), entry.value.c_str());
ESP_LOGV(TAG, "Header with name %s found with value %s", lower.c_str(), entry.value.c_str());
return entry.value;
}
}
ESP_LOGW(TAG, "No header with name %s found", lower.c_str());
return "";
}
@@ -268,6 +268,11 @@ class HttpContainer : public Parented<HttpRequestComponent> {
return !this->is_chunked_ && this->bytes_read_ >= this->content_length;
}
/**
* @brief Get the value of a response header by name.
* @param header_name The name of the header to retrieve.
* @return The value of the header if found, otherwise an empty string.
*/
std::string get_response_header(const std::string &header_name);
protected: