Skip to content

Commit

Permalink
🔇 silent changes: add base function #2 #4
Browse files Browse the repository at this point in the history
  • Loading branch information
pnguyen215 committed Dec 15, 2024
1 parent c277664 commit 5374478
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 50 deletions.
81 changes: 81 additions & 0 deletions const.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,84 @@ const (
const (
UnknownXC string = "unknown"
)

var (
// 1xx Informational responses
Continue = NewHeader().WithCode(100).WithText("Continue").WithType("Informational")
SwitchingProtocols = NewHeader().WithCode(101).WithText("Switching Protocols").WithType("Informational")
Processing = NewHeader().WithCode(102).WithText("Processing").WithType("Informational")

// 2xx Successful responses
OK = NewHeader().WithCode(200).WithText("OK").WithType("Successful")
Created = NewHeader().WithCode(201).WithText("Created").WithType("Successful")
Accepted = NewHeader().WithCode(202).WithText("Accepted").WithType("Successful")
NonAuthoritativeInformation = NewHeader().WithCode(203).WithText("Non-Authoritative Information").WithType("Successful")
NoContent = NewHeader().WithCode(204).WithText("No Content").WithType("Successful")
ResetContent = NewHeader().WithCode(205).WithText("Reset Content").WithType("Successful")
PartialContent = NewHeader().WithCode(206).WithText("Partial Content").WithType("Successful")
MultiStatus = NewHeader().WithCode(207).WithText("Multi-Status").WithType("Successful")
AlreadyReported = NewHeader().WithCode(208).WithText("Already Reported").WithType("Successful")
IMUsed = NewHeader().WithCode(226).WithText("IM Used").WithType("Successful")

// 3xx Redirection responses
MultipleChoices = NewHeader().WithCode(300).WithText("Multiple Choices").WithType("Redirection")
MovedPermanently = NewHeader().WithCode(301).WithText("Moved Permanently").WithType("Redirection")
Found = NewHeader().WithCode(302).WithText("Found").WithType("Redirection")
SeeOther = NewHeader().WithCode(303).WithText("See Other").WithType("Redirection")
NotModified = NewHeader().WithCode(304).WithText("Not Modified").WithType("Redirection")
UseProxy = NewHeader().WithCode(305).WithText("Use Proxy").WithType("Redirection")
Reserved = NewHeader().WithCode(306).WithText("Reserved").WithType("Redirection")
TemporaryRedirect = NewHeader().WithCode(307).WithText("Temporary Redirect").WithType("Redirection")
PermanentRedirect = NewHeader().WithCode(308).WithText("Permanent Redirect").WithType("Redirection")

// 4xx Client error responses
BadRequest = NewHeader().WithCode(400).WithText("Bad Request").WithType("Client Error")
Unauthorized = NewHeader().WithCode(401).WithText("Unauthorized").WithType("Client Error")
PaymentRequired = NewHeader().WithCode(402).WithText("Payment Required").WithType("Client Error")
Forbidden = NewHeader().WithCode(403).WithText("Forbidden").WithType("Client Error")
NotFound = NewHeader().WithCode(404).WithText("Not Found").WithType("Client Error")
MethodNotAllowed = NewHeader().WithCode(405).WithText("Method Not Allowed").WithType("Client Error")
NotAcceptable = NewHeader().WithCode(406).WithText("Not Acceptable").WithType("Client Error")
ProxyAuthenticationRequired = NewHeader().WithCode(407).WithText("Proxy Authentication Required").WithType("Client Error")
RequestTimeout = NewHeader().WithCode(408).WithText("Request Timeout").WithType("Client Error")
Conflict = NewHeader().WithCode(409).WithText("Conflict").WithType("Client Error")
Gone = NewHeader().WithCode(410).WithText("Gone").WithType("Client Error")
LengthRequired = NewHeader().WithCode(411).WithText("Length Required").WithType("Client Error")
PreconditionFailed = NewHeader().WithCode(412).WithText("Precondition Failed").WithType("Client Error")
RequestEntityTooLarge = NewHeader().WithCode(413).WithText("Request Entity Too Large").WithType("Client Error")
RequestURITooLong = NewHeader().WithCode(414).WithText("Request-URI Too Long").WithType("Client Error")
UnsupportedMediaType = NewHeader().WithCode(415).WithText("Unsupported Media Type").WithType("Client Error")
RequestedRangeNotSatisfiable = NewHeader().WithCode(416).WithText("Requested Range Not Satisfiable").WithType("Client Error")
ExpectationFailed = NewHeader().WithCode(417).WithText("Expectation Failed").WithType("Client Error")
ImATeapot = NewHeader().WithCode(418).WithText("I’m a teapot").WithType("Client Error")
EnhanceYourCalm = NewHeader().WithCode(420).WithText("Enhance Your Calm").WithType("Client Error")
UnprocessableEntity = NewHeader().WithCode(422).WithText("Unprocessable Entity").WithType("Client Error")
Locked = NewHeader().WithCode(423).WithText("Locked").WithType("Client Error")
FailedDependency = NewHeader().WithCode(424).WithText("Failed Dependency").WithType("Client Error")
UnorderedCollection = NewHeader().WithCode(425).WithText("Unordered Collection").WithType("Client Error")
UpgradeRequired = NewHeader().WithCode(426).WithText("Upgrade Required").WithType("Client Error")
PreconditionRequired = NewHeader().WithCode(428).WithText("Precondition Required").WithType("Client Error")
TooManyRequests = NewHeader().WithCode(429).WithText("Too Many Requests").WithType("Client Error")
RequestHeaderFieldsTooLarge = NewHeader().WithCode(431).WithText("Request Header Fields Too Large").WithType("Client Error")
NoResponse = NewHeader().WithCode(444).WithText("No Response").WithType("Client Error")
RetryWith = NewHeader().WithCode(449).WithText("Retry With").WithType("Client Error")
BlockedByWindowsParentalControls = NewHeader().WithCode(450).WithText("Blocked by Windows Parental Controls").WithType("Client Error")
UnavailableForLegalReasons = NewHeader().WithCode(451).WithText("Unavailable For Legal Reasons").WithType("Client Error")
ClientClosedRequest = NewHeader().WithCode(499).WithText("Client Closed Request").WithType("Client Error")

// 5xx Server error responses
InternalServerError = NewHeader().WithCode(500).WithText("Internal Server Error").WithType("Server Error")
NotImplemented = NewHeader().WithCode(501).WithText("Not Implemented").WithType("Server Error")
BadGateway = NewHeader().WithCode(502).WithText("Bad Gateway").WithType("Server Error")
ServiceUnavailable = NewHeader().WithCode(503).WithText("Service Unavailable").WithType("Server Error")
GatewayTimeout = NewHeader().WithCode(504).WithText("Gateway Timeout").WithType("Server Error")
HTTPVersionNotSupported = NewHeader().WithCode(505).WithText("HTTP Version Not Supported").WithType("Server Error")
VariantAlsoNegotiates = NewHeader().WithCode(506).WithText("Variant Also Negotiates").WithType("Server Error")
InsufficientStorage = NewHeader().WithCode(507).WithText("Insufficient Storage").WithType("Server Error")
LoopDetected = NewHeader().WithCode(508).WithText("Loop Detected").WithType("Server Error")
BandwidthLimitExceeded = NewHeader().WithCode(509).WithText("Bandwidth Limit Exceeded").WithType("Server Error")
NotExtended = NewHeader().WithCode(510).WithText("Not Extended").WithType("Server Error")
NetworkAuthenticationRequired = NewHeader().WithCode(511).WithText("Network Authentication Required").WithType("Server Error")
NetworkReadTimeoutError = NewHeader().WithCode(598).WithText("Network Read Timeout Error").WithType("Server Error")
NetworkConnectTimeoutError = NewHeader().WithCode(599).WithText("Network Connect Timeout Error").WithType("Server Error")
)
Loading

0 comments on commit 5374478

Please sign in to comment.