feat: add URI_TOO_LONG status code and update statusCodeInfos array

This commit is contained in:
whaffman 2025-10-30 23:05:36 +01:00
parent e8071a6dd0
commit 5b5cda23ce

View File

@ -48,6 +48,7 @@ constexpr uint16_t FORBIDDEN = 403;
constexpr uint16_t NOT_FOUND = 404; constexpr uint16_t NOT_FOUND = 404;
constexpr uint16_t METHOD_NOT_ALLOWED = 405; constexpr uint16_t METHOD_NOT_ALLOWED = 405;
constexpr uint16_t PAYLOAD_TOO_LARGE = 413; constexpr uint16_t PAYLOAD_TOO_LARGE = 413;
constexpr uint16_t URI_TOO_LONG = 414;
constexpr uint16_t INTERNAL_SERVER_ERROR = 500; constexpr uint16_t INTERNAL_SERVER_ERROR = 500;
constexpr uint16_t NOT_IMPLEMENTED = 501; constexpr uint16_t NOT_IMPLEMENTED = 501;
constexpr uint16_t BAD_GATEWAY = 502; constexpr uint16_t BAD_GATEWAY = 502;
@ -60,7 +61,7 @@ struct StatusCodeInfo
std::string_view reason; std::string_view reason;
}; };
static constexpr std::array<StatusCodeInfo, 18> statusCodeInfos static constexpr std::array<StatusCodeInfo, 19> statusCodeInfos
= {{{.code = StatusCode::OK, .reason = "OK"}, = {{{.code = StatusCode::OK, .reason = "OK"},
{.code = StatusCode::CREATED, .reason = "Created"}, {.code = StatusCode::CREATED, .reason = "Created"},
{.code = StatusCode::NO_CONTENT, .reason = "No Content"}, {.code = StatusCode::NO_CONTENT, .reason = "No Content"},
@ -75,6 +76,7 @@ static constexpr std::array<StatusCodeInfo, 18> statusCodeInfos
{.code = StatusCode::NOT_FOUND, .reason = "Not Found"}, {.code = StatusCode::NOT_FOUND, .reason = "Not Found"},
{.code = StatusCode::METHOD_NOT_ALLOWED, .reason = "Method Not Allowed"}, {.code = StatusCode::METHOD_NOT_ALLOWED, .reason = "Method Not Allowed"},
{.code = StatusCode::PAYLOAD_TOO_LARGE, .reason = "Payload Too Large"}, {.code = StatusCode::PAYLOAD_TOO_LARGE, .reason = "Payload Too Large"},
{.code = StatusCode::URI_TOO_LONG, .reason = "URI Too Long"},
{.code = StatusCode::INTERNAL_SERVER_ERROR, .reason = "Internal Server Error"}, {.code = StatusCode::INTERNAL_SERVER_ERROR, .reason = "Internal Server Error"},
{.code = StatusCode::NOT_IMPLEMENTED, .reason = "Not Implemented"}, {.code = StatusCode::NOT_IMPLEMENTED, .reason = "Not Implemented"},
{.code = StatusCode::BAD_GATEWAY, .reason = "Bad Gateway"}, {.code = StatusCode::BAD_GATEWAY, .reason = "Bad Gateway"},