remove status type

This commit is contained in:
Patricio Whittingslow
2026-07-26 13:43:31 -03:00
parent cc7ecc0c19
commit dd7c4bb037
3 changed files with 67 additions and 206 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"github.com/soypat/lneto/internal"
)
//go:generate stringer -type Method,status -linecomment -output stringers.go
//go:generate stringer -type Method -linecomment -output stringers.go
// reconfigureWait bounds how long [Router.Configure] waits for the previous
// generation to stop serving before reusing its exchange buffers.
+65 -63
View File
@@ -133,139 +133,141 @@ func StatusText(code int) string {
}
}
const ()
type status int
// HTTP status codes as registered with IANA.
// See: https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
const (
// RFC 9110, 15.2.1
StatusContinue status = 100 // Continue
StatusContinue = 100 // Continue
// RFC 9110, 15.2.2
StatusSwitchingProtocols status = 101 // Switching Protocols
StatusSwitchingProtocols = 101 // Switching Protocols
// RFC 2518, 10.1
StatusProcessing status = 102 // Processing
StatusProcessing = 102 // Processing
// RFC 8297
StatusEarlyHints status = 103 // Early Hints
StatusEarlyHints = 103 // Early Hints
// RFC 9110, 15.3.1
StatusOK status = 200 // OK
StatusOK = 200 // OK
// RFC 9110, 15.3.2
StatusCreated status = 201 // Created
StatusCreated = 201 // Created
// RFC 9110, 15.3.3
StatusAccepted status = 202 // Accepted
StatusAccepted = 202 // Accepted
// RFC 9110, 15.3.4
StatusNonAuthoritativeInfo status = 203 // Non-Authoritative Information
StatusNonAuthoritativeInfo = 203 // Non-Authoritative Information
// RFC 9110, 15.3.5
StatusNoContent status = 204 // No Content
StatusNoContent = 204 // No Content
// RFC 9110, 15.3.6
StatusResetContent status = 205 // Reset Content
StatusResetContent = 205 // Reset Content
// RFC 9110, 15.3.7
StatusPartialContent status = 206 // Partial Content
StatusPartialContent = 206 // Partial Content
// RFC 4918, 11.1
StatusMultiStatus status = 207 // Multi-Status
StatusMultiStatus = 207 // Multi-Status
// RFC 5842, 7.1
StatusAlreadyReported status = 208 // Already Reported
StatusAlreadyReported = 208 // Already Reported
// RFC 3229, 10.4.1
StatusIMUsed status = 226 // IM Used
StatusIMUsed = 226 // IM Used
// RFC 9110, 15.4.1
StatusMultipleChoices status = 300 // Multiple Choices
StatusMultipleChoices = 300 // Multiple Choices
// RFC 9110, 15.4.2
StatusMovedPermanently status = 301 // Moved Permanently
StatusMovedPermanently = 301 // Moved Permanently
// RFC 9110, 15.4.3
StatusFound status = 302 // Found
StatusFound = 302 // Found
// RFC 9110, 15.4.4
StatusSeeOther status = 303 // See Other
StatusSeeOther = 303 // See Other
// RFC 9110, 15.4.5
StatusNotModified status = 304 // Not Modified
StatusNotModified = 304 // Not Modified
// RFC 9110, 15.4.6
StatusUseProxy status = 305 // Use Proxy
StatusUseProxy = 305 // Use Proxy
// RFC 9110, 15.4.7 (Unused)
_ status = 306
_ = 306
// RFC 9110, 15.4.8
StatusTemporaryRedirect status = 307 // Temporary Redirect
StatusTemporaryRedirect = 307 // Temporary Redirect
// RFC 9110, 15.4.9
StatusPermanentRedirect status = 308 // Permanent Redirect
StatusPermanentRedirect = 308 // Permanent Redirect
// RFC 9110, 15.5.1
StatusBadRequest status = 400 // Bad Request
StatusBadRequest = 400 // Bad Request
// RFC 9110, 15.5.2
StatusUnauthorized status = 401 // Unauthorized
StatusUnauthorized = 401 // Unauthorized
// RFC 9110, 15.5.3
StatusPaymentRequired status = 402 // Payment Required
StatusPaymentRequired = 402 // Payment Required
// RFC 9110, 15.5.4
StatusForbidden status = 403 // Forbidden
StatusForbidden = 403 // Forbidden
// RFC 9110, 15.5.5
StatusNotFound status = 404 // Not Found
StatusNotFound = 404 // Not Found
// RFC 9110, 15.5.6
StatusMethodNotAllowed status = 405 // Method Not Allowed
StatusMethodNotAllowed = 405 // Method Not Allowed
// RFC 9110, 15.5.7
StatusNotAcceptable status = 406 // Not Acceptable
StatusNotAcceptable = 406 // Not Acceptable
// RFC 9110, 15.5.8
StatusProxyAuthRequired status = 407 // Proxy Authentication Required
StatusProxyAuthRequired = 407 // Proxy Authentication Required
// RFC 9110, 15.5.9
StatusRequestTimeout status = 408 // Request Timeout
StatusRequestTimeout = 408 // Request Timeout
// RFC 9110, 15.5.10
StatusConflict status = 409 // Conflict
StatusConflict = 409 // Conflict
// RFC 9110, 15.5.11
StatusGone status = 410 // Gone
StatusGone = 410 // Gone
// RFC 9110, 15.5.12
StatusLengthRequired status = 411 // Length Required
StatusLengthRequired = 411 // Length Required
// RFC 9110, 15.5.13
StatusPreconditionFailed status = 412 // Precondition Failed
StatusPreconditionFailed = 412 // Precondition Failed
// RFC 9110, 15.5.14
StatusRequestEntityTooLarge status = 413 // Request Entity Too Large
StatusRequestEntityTooLarge = 413 // Request Entity Too Large
// RFC 9110, 15.5.15
StatusRequestURITooLong status = 414 // Request URI Too Long
StatusRequestURITooLong = 414 // Request URI Too Long
// RFC 9110, 15.5.16
StatusUnsupportedMediaType status = 415 // Unsupported Media Type
StatusUnsupportedMediaType = 415 // Unsupported Media Type
// RFC 9110, 15.5.17
StatusRequestedRangeNotSatisfiable status = 416 // Requested Range Not Satisfiable
StatusRequestedRangeNotSatisfiable = 416 // Requested Range Not Satisfiable
// RFC 9110, 15.5.18
StatusExpectationFailed status = 417 // Expectation Failed
StatusExpectationFailed = 417 // Expectation Failed
// RFC 9110, 15.5.19 (Unused)
StatusTeapot status = 418 // I'm a teapot
StatusTeapot = 418 // I'm a teapot
// RFC 9110, 15.5.20
StatusMisdirectedRequest status = 421 // Misdirected Request
StatusMisdirectedRequest = 421 // Misdirected Request
// RFC 9110, 15.5.21
StatusUnprocessableEntity status = 422 // Unprocessable Entity
StatusUnprocessableEntity = 422 // Unprocessable Entity
// RFC 4918, 11.3
StatusLocked status = 423 // Locked
StatusLocked = 423 // Locked
// RFC 4918, 11.4
StatusFailedDependency status = 424 // Failed Dependency
StatusFailedDependency = 424 // Failed Dependency
// RFC 8470, 5.2.
StatusTooEarly status = 425 // Too Early
StatusTooEarly = 425 // Too Early
// RFC 9110, 15.5.22
StatusUpgradeRequired status = 426 // Upgrade Required
StatusUpgradeRequired = 426 // Upgrade Required
// RFC 6585, 3
StatusPreconditionRequired status = 428 // Precondition Required
StatusPreconditionRequired = 428 // Precondition Required
// RFC 6585, 4
StatusTooManyRequests status = 429 // Too Many Requests
StatusTooManyRequests = 429 // Too Many Requests
// RFC 6585, 5
StatusRequestHeaderFieldsTooLarge status = 431 // Request Header Fields Too Large
StatusRequestHeaderFieldsTooLarge = 431 // Request Header Fields Too Large
// RFC 7725, 3
StatusUnavailableForLegalReasons status = 451 // Unavailable For Legal Reasons
StatusUnavailableForLegalReasons = 451 // Unavailable For Legal Reasons
// RFC 9110, 15.6.1
StatusInternalServerError status = 500 // Internal Server Error
StatusInternalServerError = 500 // Internal Server Error
// RFC 9110, 15.6.2
StatusNotImplemented status = 501 // Not Implemented
StatusNotImplemented = 501 // Not Implemented
// RFC 9110, 15.6.3
StatusBadGateway status = 502 // Bad Gateway
StatusBadGateway = 502 // Bad Gateway
// RFC 9110, 15.6.4
StatusServiceUnavailable status = 503 // Service Unavailable
StatusServiceUnavailable = 503 // Service Unavailable
// RFC 9110, 15.6.5
StatusGatewayTimeout status = 504 // Gateway Timeout
StatusGatewayTimeout = 504 // Gateway Timeout
// RFC 9110, 15.6.6
StatusHTTPVersionNotSupported status = 505 // HTTP Version Not Supported
StatusHTTPVersionNotSupported = 505 // HTTP Version Not Supported
// RFC 2295, 8.1
StatusVariantAlsoNegotiates status = 506 // Variant Also Negotiates
StatusVariantAlsoNegotiates = 506 // Variant Also Negotiates
// RFC 4918, 11.5
StatusInsufficientStorage status = 507 // Insufficient Storage
StatusInsufficientStorage = 507 // Insufficient Storage
// RFC 5842, 7.2
StatusLoopDetected status = 508 // Loop Detected
StatusLoopDetected = 508 // Loop Detected
// RFC 2774, 7
StatusNotExtended status = 510 // Not Extended
StatusNotExtended = 510 // Not Extended
// RFC 6585, 6
StatusNetworkAuthenticationRequired status = 511 // Network Authentication Required
StatusNetworkAuthenticationRequired = 511 // Network Authentication Required
)
+1 -142
View File
@@ -1,4 +1,4 @@
// Code generated by "stringer -type Method,status -linecomment -output stringers.go"; DO NOT EDIT.
// Code generated by "stringer -type Method -linecomment -output stringers.go"; DO NOT EDIT.
package httphi
@@ -32,144 +32,3 @@ func (i Method) String() string {
}
return _Method_name[_Method_index[idx]:_Method_index[idx+1]]
}
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[StatusContinue-100]
_ = x[StatusSwitchingProtocols-101]
_ = x[StatusProcessing-102]
_ = x[StatusEarlyHints-103]
_ = x[StatusOK-200]
_ = x[StatusCreated-201]
_ = x[StatusAccepted-202]
_ = x[StatusNonAuthoritativeInfo-203]
_ = x[StatusNoContent-204]
_ = x[StatusResetContent-205]
_ = x[StatusPartialContent-206]
_ = x[StatusMultiStatus-207]
_ = x[StatusAlreadyReported-208]
_ = x[StatusIMUsed-226]
_ = x[StatusMultipleChoices-300]
_ = x[StatusMovedPermanently-301]
_ = x[StatusFound-302]
_ = x[StatusSeeOther-303]
_ = x[StatusNotModified-304]
_ = x[StatusUseProxy-305]
_ = x[StatusTemporaryRedirect-307]
_ = x[StatusPermanentRedirect-308]
_ = x[StatusBadRequest-400]
_ = x[StatusUnauthorized-401]
_ = x[StatusPaymentRequired-402]
_ = x[StatusForbidden-403]
_ = x[StatusNotFound-404]
_ = x[StatusMethodNotAllowed-405]
_ = x[StatusNotAcceptable-406]
_ = x[StatusProxyAuthRequired-407]
_ = x[StatusRequestTimeout-408]
_ = x[StatusConflict-409]
_ = x[StatusGone-410]
_ = x[StatusLengthRequired-411]
_ = x[StatusPreconditionFailed-412]
_ = x[StatusRequestEntityTooLarge-413]
_ = x[StatusRequestURITooLong-414]
_ = x[StatusUnsupportedMediaType-415]
_ = x[StatusRequestedRangeNotSatisfiable-416]
_ = x[StatusExpectationFailed-417]
_ = x[StatusTeapot-418]
_ = x[StatusMisdirectedRequest-421]
_ = x[StatusUnprocessableEntity-422]
_ = x[StatusLocked-423]
_ = x[StatusFailedDependency-424]
_ = x[StatusTooEarly-425]
_ = x[StatusUpgradeRequired-426]
_ = x[StatusPreconditionRequired-428]
_ = x[StatusTooManyRequests-429]
_ = x[StatusRequestHeaderFieldsTooLarge-431]
_ = x[StatusUnavailableForLegalReasons-451]
_ = x[StatusInternalServerError-500]
_ = x[StatusNotImplemented-501]
_ = x[StatusBadGateway-502]
_ = x[StatusServiceUnavailable-503]
_ = x[StatusGatewayTimeout-504]
_ = x[StatusHTTPVersionNotSupported-505]
_ = x[StatusVariantAlsoNegotiates-506]
_ = x[StatusInsufficientStorage-507]
_ = x[StatusLoopDetected-508]
_ = x[StatusNotExtended-510]
_ = x[StatusNetworkAuthenticationRequired-511]
}
const _status_name = "ContinueSwitching ProtocolsProcessingEarly HintsOKCreatedAcceptedNon-Authoritative InformationNo ContentReset ContentPartial ContentMulti-StatusAlready ReportedIM UsedMultiple ChoicesMoved PermanentlyFoundSee OtherNot ModifiedUse ProxyTemporary RedirectPermanent RedirectBad RequestUnauthorizedPayment RequiredForbiddenNot FoundMethod Not AllowedNot AcceptableProxy Authentication RequiredRequest TimeoutConflictGoneLength RequiredPrecondition FailedRequest Entity Too LargeRequest URI Too LongUnsupported Media TypeRequested Range Not SatisfiableExpectation FailedI'm a teapotMisdirected RequestUnprocessable EntityLockedFailed DependencyToo EarlyUpgrade RequiredPrecondition RequiredToo Many RequestsRequest Header Fields Too LargeUnavailable For Legal ReasonsInternal Server ErrorNot ImplementedBad GatewayService UnavailableGateway TimeoutHTTP Version Not SupportedVariant Also NegotiatesInsufficient StorageLoop DetectedNot ExtendedNetwork Authentication Required"
var _status_map = map[status]string{
100: _status_name[0:8],
101: _status_name[8:27],
102: _status_name[27:37],
103: _status_name[37:48],
200: _status_name[48:50],
201: _status_name[50:57],
202: _status_name[57:65],
203: _status_name[65:94],
204: _status_name[94:104],
205: _status_name[104:117],
206: _status_name[117:132],
207: _status_name[132:144],
208: _status_name[144:160],
226: _status_name[160:167],
300: _status_name[167:183],
301: _status_name[183:200],
302: _status_name[200:205],
303: _status_name[205:214],
304: _status_name[214:226],
305: _status_name[226:235],
307: _status_name[235:253],
308: _status_name[253:271],
400: _status_name[271:282],
401: _status_name[282:294],
402: _status_name[294:310],
403: _status_name[310:319],
404: _status_name[319:328],
405: _status_name[328:346],
406: _status_name[346:360],
407: _status_name[360:389],
408: _status_name[389:404],
409: _status_name[404:412],
410: _status_name[412:416],
411: _status_name[416:431],
412: _status_name[431:450],
413: _status_name[450:474],
414: _status_name[474:494],
415: _status_name[494:516],
416: _status_name[516:547],
417: _status_name[547:565],
418: _status_name[565:577],
421: _status_name[577:596],
422: _status_name[596:616],
423: _status_name[616:622],
424: _status_name[622:639],
425: _status_name[639:648],
426: _status_name[648:664],
428: _status_name[664:685],
429: _status_name[685:702],
431: _status_name[702:733],
451: _status_name[733:762],
500: _status_name[762:783],
501: _status_name[783:798],
502: _status_name[798:809],
503: _status_name[809:828],
504: _status_name[828:843],
505: _status_name[843:869],
506: _status_name[869:892],
507: _status_name[892:912],
508: _status_name[912:925],
510: _status_name[925:937],
511: _status_name[937:968],
}
func (i status) String() string {
if str, ok := _status_map[i]; ok {
return str
}
return "status(" + strconv.FormatInt(int64(i), 10) + ")"
}