mirror of
https://github.com/zigzap/zap.git
synced 2025-10-20 23:24:09 +00:00
fix: the bug no field named 'xxx' in enum 'http.StatusCode'. Closes #178
This commit is contained in:
parent
302f1e1e44
commit
aac36cf555
1 changed files with 38 additions and 8 deletions
46
src/http.zig
46
src/http.zig
|
@ -82,22 +82,36 @@ pub const StatusCode = enum(u16) {
|
||||||
/// for example: .ResetContent returns "Returns Content".
|
/// for example: .ResetContent returns "Returns Content".
|
||||||
pub fn toString(self: StatusCode) []const u8 {
|
pub fn toString(self: StatusCode) []const u8 {
|
||||||
return switch (self) {
|
return switch (self) {
|
||||||
|
// 1xx
|
||||||
.@"continue" => "Continue",
|
.@"continue" => "Continue",
|
||||||
.switching_protocols => "Switching Protocols",
|
.switching_protocols => "Switching Protocols",
|
||||||
.ok => "Ok",
|
.processing => "Processing",
|
||||||
|
.early_hints => "Early Hints",
|
||||||
|
|
||||||
|
// 2xx
|
||||||
|
.ok => "OK",
|
||||||
.created => "Created",
|
.created => "Created",
|
||||||
.accepted => "Accepted",
|
.accepted => "Accepted",
|
||||||
.non_authoritative_information => "Non Authoritative Information",
|
.non_authoritative_information => "Non Authoritative Information",
|
||||||
.no_content => "No Content",
|
.no_content => "No Content",
|
||||||
.reset_content => "Reset Content",
|
.reset_content => "Reset Content",
|
||||||
.partial_content => "Partial Content",
|
.partial_content => "Partial Content",
|
||||||
|
.multi_status => "Multi-Status",
|
||||||
|
.already_reported => "Already Reported",
|
||||||
|
.im_used => "IM Used",
|
||||||
|
|
||||||
|
// 3xx
|
||||||
.multiple_choices => "Multiple Choices",
|
.multiple_choices => "Multiple Choices",
|
||||||
.moved_permanently => "Moved Permanently",
|
.moved_permanently => "Moved Permanently",
|
||||||
.found => "Found",
|
.found => "Found",
|
||||||
.see_other => "See Other",
|
.see_other => "See Other",
|
||||||
.not_modified => "Not Modified",
|
.not_modified => "Not Modified",
|
||||||
.use_proxy => "Use Proxy",
|
.use_proxy => "Use Proxy",
|
||||||
|
.unused => "Unused",
|
||||||
.temporary_redirect => "Temporary Redirect",
|
.temporary_redirect => "Temporary Redirect",
|
||||||
|
.permanent_redirect => "Permanent Redirect",
|
||||||
|
|
||||||
|
// 4xx
|
||||||
.bad_request => "Bad Request",
|
.bad_request => "Bad Request",
|
||||||
.unauthorized => "Unauthorized",
|
.unauthorized => "Unauthorized",
|
||||||
.payment_required => "Payment Required",
|
.payment_required => "Payment Required",
|
||||||
|
@ -111,20 +125,36 @@ pub const StatusCode = enum(u16) {
|
||||||
.gone => "Gone",
|
.gone => "Gone",
|
||||||
.length_required => "Length Required",
|
.length_required => "Length Required",
|
||||||
.precondition_failed => "Precondition Failed",
|
.precondition_failed => "Precondition Failed",
|
||||||
.request_entity_too_large => "Request Entity Too Large",
|
.payload_too_large => "Payload Too Large",
|
||||||
.request_uri_too_long => "Request-URI Too Long",
|
.uri_too_long => "URI Too Long",
|
||||||
.unsupported_mediatype => "Unsupported Media Type",
|
.unsupported_media_type => "Unsupported Media Type",
|
||||||
.requested_range_not_satisfiable => "Requested Range Not Satisfiable",
|
.range_not_satisfiable => "Range Not Satisfiable",
|
||||||
.teapot => "I'm a Teapot",
|
|
||||||
.upgrade_required => "Upgrade Required",
|
|
||||||
.request_header_fields_too_large => "Request Header Fields Too Large",
|
|
||||||
.expectation_failed => "Expectation Failed",
|
.expectation_failed => "Expectation Failed",
|
||||||
|
.im_a_teapot => "I'm a Teapot",
|
||||||
|
.misdirected_request => "Misdirected Request",
|
||||||
|
.unprocessable_content => "Unprocessable Content",
|
||||||
|
.locked => "Locked",
|
||||||
|
.failed_dependency => "Failed Dependency",
|
||||||
|
.too_early => "Too Early",
|
||||||
|
.upgrade_required => "Upgrade Required",
|
||||||
|
.precondition_required => "Precondition Required",
|
||||||
|
.too_many_requests => "Too Many Requests",
|
||||||
|
.request_header_fields_too_large => "Request Header Fields Too Large",
|
||||||
|
.unavailable_for_legal_reasons => "Unavailable For Legal Reasons",
|
||||||
|
|
||||||
|
// 5xx
|
||||||
.internal_server_error => "Internal Server Error",
|
.internal_server_error => "Internal Server Error",
|
||||||
.not_implemented => "Not Implemented",
|
.not_implemented => "Not Implemented",
|
||||||
.bad_gateway => "Bad Gateway",
|
.bad_gateway => "Bad Gateway",
|
||||||
.service_unavailable => "Service Unavailable",
|
.service_unavailable => "Service Unavailable",
|
||||||
.gateway_timeout => "Gateway Timeout",
|
.gateway_timeout => "Gateway Timeout",
|
||||||
.http_version_not_supported => "HTTP Version Not Supported",
|
.http_version_not_supported => "HTTP Version Not Supported",
|
||||||
|
.variant_also_negotiates => "Variant Also Negotiates",
|
||||||
|
.insufficient_storage => "Insufficient Storage",
|
||||||
|
.loop_detected => "Loop Detected",
|
||||||
|
.not_extended => "Not Extended",
|
||||||
|
.network_authentication_required => "Network Authentication Required",
|
||||||
|
|
||||||
_ => "",
|
_ => "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue