mirror of
https://github.com/esphome/esphome.git
synced 2026-02-28 01:44:20 -07:00
[http_request] Ensure start() vector overload lowercases collect_headers
The vector overload of start() was passing collect_headers directly
to perform() without lowercasing. This meant callers using get()/post()
with mixed-case header names (e.g. {"ETag"}) would fail to match
against the lowercased header names from the HTTP response.
This commit is contained in:
@@ -374,7 +374,12 @@ class HttpRequestComponent : public Component {
|
||||
std::shared_ptr<HttpContainer> start(const std::string &url, const std::string &method, const std::string &body,
|
||||
const std::list<Header> &request_headers,
|
||||
const std::vector<std::string> &collect_headers) {
|
||||
return this->perform(url, method, body, request_headers, collect_headers);
|
||||
std::vector<std::string> lower_case_collect_headers;
|
||||
lower_case_collect_headers.reserve(collect_headers.size());
|
||||
for (const auto &header : collect_headers) {
|
||||
lower_case_collect_headers.push_back(str_lower_case(header));
|
||||
}
|
||||
return this->perform(url, method, body, request_headers, lower_case_collect_headers);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user