mirror of
https://github.com/esphome/esphome.git
synced 2026-02-21 00:45:35 -07:00
Merge branch 'web_server_idf_appends' into integration
This commit is contained in:
@@ -246,8 +246,8 @@ void AsyncWebServerRequest::redirect(const std::string &url) {
|
||||
}
|
||||
|
||||
void AsyncWebServerRequest::init_response_(AsyncWebServerResponse *rsp, int code, const char *content_type) {
|
||||
// Set status code - use constants for common codes to avoid string allocation
|
||||
const char *status = nullptr;
|
||||
// Set status code - use constants for common codes, default to 500 for unknown codes
|
||||
const char *status;
|
||||
switch (code) {
|
||||
case 200:
|
||||
status = HTTPD_200;
|
||||
@@ -259,9 +259,10 @@ void AsyncWebServerRequest::init_response_(AsyncWebServerResponse *rsp, int code
|
||||
status = HTTPD_409;
|
||||
break;
|
||||
default:
|
||||
status = HTTPD_500;
|
||||
break;
|
||||
}
|
||||
httpd_resp_set_status(*this, status == nullptr ? to_string(code).c_str() : status);
|
||||
httpd_resp_set_status(*this, status);
|
||||
|
||||
if (content_type && *content_type) {
|
||||
httpd_resp_set_type(*this, content_type);
|
||||
|
||||
29
tests/components/web_server_idf/common.yaml
Normal file
29
tests/components/web_server_idf/common.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
esphome:
|
||||
name: test-web-server-idf
|
||||
|
||||
esp32:
|
||||
board: esp32dev
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
network:
|
||||
|
||||
# Add some entities to test SSE event formatting
|
||||
sensor:
|
||||
- platform: template
|
||||
name: "Test Sensor"
|
||||
id: test_sensor
|
||||
update_interval: 60s
|
||||
lambda: "return 42.5;"
|
||||
|
||||
binary_sensor:
|
||||
- platform: template
|
||||
name: "Test Binary Sensor"
|
||||
id: test_binary_sensor
|
||||
lambda: "return true;"
|
||||
|
||||
switch:
|
||||
- platform: template
|
||||
name: "Test Switch"
|
||||
id: test_switch
|
||||
optimistic: true
|
||||
3
tests/components/web_server_idf/test.esp32-idf.yaml
Normal file
3
tests/components/web_server_idf/test.esp32-idf.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
<<: !include common.yaml
|
||||
|
||||
web_server:
|
||||
Reference in New Issue
Block a user