From b5bdfb30890a1d8dac9d97e77ed30da00c7a7242 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Tue, 29 Apr 2025 11:45:41 +1200 Subject: [PATCH] [http_request] Fix request headers (#8644) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- esphome/components/http_request/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/http_request/__init__.py b/esphome/components/http_request/__init__.py index 4da49ddde1..9aa0c42fa2 100644 --- a/esphome/components/http_request/__init__.py +++ b/esphome/components/http_request/__init__.py @@ -295,8 +295,8 @@ async def http_request_action_to_code(config, action_id, template_arg, args): for key in json_: template_ = await cg.templatable(json_[key], args, cg.std_string) cg.add(var.add_json(key, template_)) - for key in config.get(CONF_REQUEST_HEADERS, []): - template_ = await cg.templatable(key, args, cg.std_string) + for key, value in config.get(CONF_REQUEST_HEADERS, {}).items(): + template_ = await cg.templatable(value, args, cg.const_char_ptr) cg.add(var.add_request_header(key, template_)) for value in config.get(CONF_COLLECT_HEADERS, []):