1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-25 04:45:57 +00:00

Add some unofficial http error codes

Former-commit-id: 5b9ed411e446e5e4d5e6c3ec705c314cc5c1c9ec
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-05-16 23:40:42 +03:00
parent f482e13fb7
commit 571322f595
4 changed files with 132 additions and 34 deletions

20
iris.go
View File

@@ -78,6 +78,7 @@ const (
StatusLengthRequired = 411 // RFC 7231, 6.5.10
StatusPreconditionFailed = 412 // RFC 7232, 4.2
StatusRequestEntityTooLarge = 413 // RFC 7231, 6.5.11
StatusPayloadTooRage = StatusRequestEntityTooLarge
StatusRequestURITooLong = 414 // RFC 7231, 6.5.12
StatusUnsupportedMediaType = 415 // RFC 7231, 6.5.13
StatusRequestedRangeNotSatisfiable = 416 // RFC 7233, 4.4
@@ -93,7 +94,12 @@ const (
StatusTooManyRequests = 429 // RFC 6585, 4
StatusRequestHeaderFieldsTooLarge = 431 // RFC 6585, 5
StatusUnavailableForLegalReasons = 451 // RFC 7725, 3
// Unofficial Client Errors.
StatusPageExpired = router.StatusPageExpired
StatusBlockedByWindowsParentalControls = router.StatusBlockedByWindowsParentalControls
StatusInvalidToken = router.StatusInvalidToken
StatusTokenRequired = router.StatusTokenRequired
//
StatusInternalServerError = 500 // RFC 7231, 6.6.1
StatusNotImplemented = 501 // RFC 7231, 6.6.2
StatusBadGateway = 502 // RFC 7231, 6.6.3
@@ -105,8 +111,20 @@ const (
StatusLoopDetected = 508 // RFC 5842, 7.2
StatusNotExtended = 510 // RFC 2774, 7
StatusNetworkAuthenticationRequired = 511 // RFC 6585, 6
// Unofficial Server Errors.
StatusBandwidthLimitExceeded = router.StatusBandwidthLimitExceeded
StatusInvalidSSLCertificate = router.StatusInvalidSSLCertificate
StatusSiteOverloaded = router.StatusSiteOverloaded
StatusSiteFrozen = router.StatusSiteFrozen
StatusNetworkReadTimeout = router.StatusNetworkReadTimeout
)
// StatusText returns a text for the HTTP status code. It returns the empty
// string if the code is unknown.
//
// Shortcut for core/router#StatusText.
var StatusText = router.StatusText
// HTTP Methods copied from `net/http`.
const (
MethodGet = "GET"