esp_http_server: Add some response error code, such as 401, 403 etc.

Closes https://github.com/espressif/esp-idf/issues/5466
This commit is contained in:
Liu Han
2020-11-30 11:23:35 +08:00
committed by bot
parent 4605a8ac80
commit 669d9820fc
2 changed files with 19 additions and 0 deletions

View File

@@ -399,6 +399,14 @@ esp_err_t httpd_resp_send_err(httpd_req_t *req, httpd_err_code_t error, const ch
status = "400 Bad Request";
msg = "Server unable to understand request due to invalid syntax";
break;
case HTTPD_401_UNAUTHORIZED:
status = "401 Unauthorized";
msg = "Server known the client's identify and it must authenticate itself to get he requested response";
break;
case HTTPD_403_FORBIDDEN:
status = "403 Forbidden";
msg = "Server is refusing to give the requested resource to the client";
break;
case HTTPD_404_NOT_FOUND:
status = "404 Not Found";
msg = "This URI does not exist";