-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttpstatus.go
46 lines (44 loc) · 2.45 KB
/
httpstatus.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package globalerrors
import "net/http"
var httpStatusCodesMap = map[error]int{
BadRequest: http.StatusBadRequest,
Unauthorized: http.StatusUnauthorized,
PaymentRequired: http.StatusPaymentRequired,
Forbidden: http.StatusForbidden,
NotFound: http.StatusNotFound,
MethodNotAllowed: http.StatusMethodNotAllowed,
NotAcceptable: http.StatusNotAcceptable,
ProxyAuthRequired: http.StatusProxyAuthRequired,
RequestTimeout: http.StatusRequestTimeout,
Conflict: http.StatusConflict,
Gone: http.StatusGone,
LengthRequired: http.StatusLengthRequired,
PreconditionFailed: http.StatusPreconditionFailed,
RequestEntityTooLarge: http.StatusRequestEntityTooLarge,
RequestURITooLong: http.StatusRequestURITooLong,
UnsupportedMediaType: http.StatusUnsupportedMediaType,
RequestedRangeNotSatisfiable: http.StatusRequestedRangeNotSatisfiable,
ExpectationFailed: http.StatusExpectationFailed,
Teapot: http.StatusTeapot,
MisdirectedRequest: http.StatusMisdirectedRequest,
UnprocessableEntity: http.StatusUnprocessableEntity,
Locked: http.StatusLocked,
FailedDependency: http.StatusFailedDependency,
TooEarly: http.StatusTooEarly,
UpgradeRequired: http.StatusUpgradeRequired,
PreconditionRequired: http.StatusPreconditionRequired,
TooManyRequests: http.StatusTooManyRequests,
RequestHeaderFieldsTooLarge: http.StatusRequestHeaderFieldsTooLarge,
UnavailableForLegalReasons: http.StatusUnavailableForLegalReasons,
InternalServerError: http.StatusInternalServerError,
NotImplemented: http.StatusNotImplemented,
BadGateway: http.StatusBadGateway,
ServiceUnavailable: http.StatusServiceUnavailable,
GatewayTimeout: http.StatusGatewayTimeout,
HTTPVersionNotSupported: http.StatusHTTPVersionNotSupported,
VariantAlsoNegotiates: http.StatusVariantAlsoNegotiates,
InsufficientStorage: http.StatusInsufficientStorage,
LoopDetected: http.StatusLoopDetected,
NotExtended: http.StatusNotExtended,
NetworkAuthenticationRequired: http.StatusNetworkAuthenticationRequired,
}