1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-20 08:46:01 +00:00

Merge branch 'integration' into memory_api

This commit is contained in:
J. Nick Koston
2025-11-01 13:05:01 -05:00

View File

@@ -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);