| 246 | } |
| 247 | |
| 248 | void sendText(httpd_req_t *req, int status, const char *type, const String &body) { |
| 249 | httpd_resp_set_status( |
| 250 | req, |
| 251 | status == 200 ? "200 OK" |
| 252 | : status == 400 ? "400 Bad Request" |
| 253 | : status == 401 ? "401 Unauthorized" |
| 254 | : status == 404 ? "404 Not Found" |
| 255 | : "500 Internal Server Error" |
| 256 | ); |
| 257 | httpd_resp_set_type(req, type); |
| 258 | httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); |
| 259 | httpd_resp_send(req, body.c_str(), body.length()); |
| 260 | } |
| 261 | |
| 262 | void sendText(httpd_req_t *req, const char *type, const String &body) { sendText(req, 200, type, body); } |
| 263 |
no outgoing calls
no test coverage detected