Added webserver_prepare_response()
This commit is contained in:
@ -83,6 +83,14 @@ const char *errorToStatus(httpd_err_code_t error)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t webserver_prepare_response(httpd_req_t *req)
|
||||||
|
{
|
||||||
|
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Connection", "close")
|
||||||
|
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_hdr, req, "Access-Control-Allow-Origin", "*")
|
||||||
|
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t webserver_resp_send_succ(httpd_req_t *req, const char *type, std::string_view body)
|
esp_err_t webserver_resp_send_succ(httpd_req_t *req, const char *type, std::string_view body)
|
||||||
{
|
{
|
||||||
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_type, req, type)
|
CALL_AND_EXIT_ON_ERROR(httpd_resp_set_type, req, type)
|
||||||
|
@ -21,6 +21,8 @@ tl::expected<void, std::string> urlverify(std::string_view str);
|
|||||||
|
|
||||||
const char *errorToStatus(httpd_err_code_t error);
|
const char *errorToStatus(httpd_err_code_t error);
|
||||||
|
|
||||||
|
esp_err_t webserver_prepare_response(httpd_req_t *req);
|
||||||
|
|
||||||
esp_err_t webserver_resp_send_succ(httpd_req_t *req, const char *type, std::string_view body);
|
esp_err_t webserver_resp_send_succ(httpd_req_t *req, const char *type, std::string_view body);
|
||||||
esp_err_t webserver_resp_send_err(httpd_req_t *req, httpd_err_code_t error, const char *type, std::string_view body);
|
esp_err_t webserver_resp_send_err(httpd_req_t *req, httpd_err_code_t error, const char *type, std::string_view body);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user