mirror of
https://github.com/esphome/esphome.git
synced 2025-10-07 04:13:47 +01:00
Merge branch 'idf_query' into integration
This commit is contained in:
@@ -232,7 +232,7 @@ void AsyncWebServerRequest::redirect(const std::string &url) {
|
|||||||
|
|
||||||
void AsyncWebServerRequest::init_response_(AsyncWebServerResponse *rsp, int code, const char *content_type) {
|
void AsyncWebServerRequest::init_response_(AsyncWebServerResponse *rsp, int code, const char *content_type) {
|
||||||
// Set status code - use constants for common codes to avoid string allocation
|
// Set status code - use constants for common codes to avoid string allocation
|
||||||
const char *status;
|
const char *status = nullptr;
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 200:
|
case 200:
|
||||||
status = HTTPD_200;
|
status = HTTPD_200;
|
||||||
@@ -244,10 +244,9 @@ void AsyncWebServerRequest::init_response_(AsyncWebServerResponse *rsp, int code
|
|||||||
status = HTTPD_409;
|
status = HTTPD_409;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
status = to_string(code).c_str();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
httpd_resp_set_status(*this, status);
|
httpd_resp_set_status(*this, status == nullptr ? to_string(code).c_str() : status);
|
||||||
|
|
||||||
if (content_type && *content_type) {
|
if (content_type && *content_type) {
|
||||||
httpd_resp_set_type(*this, content_type);
|
httpd_resp_set_type(*this, content_type);
|
||||||
|
Reference in New Issue
Block a user