Source file
src/net/http/status.go
1
2
3
4
5 package http
6
7
8
9 const (
10 StatusContinue = 100
11 StatusSwitchingProtocols = 101
12 StatusProcessing = 102
13 StatusEarlyHints = 103
14
15 StatusOK = 200
16 StatusCreated = 201
17 StatusAccepted = 202
18 StatusNonAuthoritativeInfo = 203
19 StatusNoContent = 204
20 StatusResetContent = 205
21 StatusPartialContent = 206
22 StatusMultiStatus = 207
23 StatusAlreadyReported = 208
24 StatusIMUsed = 226
25
26 StatusMultipleChoices = 300
27 StatusMovedPermanently = 301
28 StatusFound = 302
29 StatusSeeOther = 303
30 StatusNotModified = 304
31 StatusUseProxy = 305
32 _ = 306
33 StatusTemporaryRedirect = 307
34 StatusPermanentRedirect = 308
35
36 StatusBadRequest = 400
37 StatusUnauthorized = 401
38 StatusPaymentRequired = 402
39 StatusForbidden = 403
40 StatusNotFound = 404
41 StatusMethodNotAllowed = 405
42 StatusNotAcceptable = 406
43 StatusProxyAuthRequired = 407
44 StatusRequestTimeout = 408
45 StatusConflict = 409
46 StatusGone = 410
47 StatusLengthRequired = 411
48 StatusPreconditionFailed = 412
49 StatusRequestEntityTooLarge = 413
50 StatusRequestURITooLong = 414
51 StatusUnsupportedMediaType = 415
52 StatusRequestedRangeNotSatisfiable = 416
53 StatusExpectationFailed = 417
54 StatusTeapot = 418
55 StatusMisdirectedRequest = 421
56 StatusUnprocessableEntity = 422
57 StatusLocked = 423
58 StatusFailedDependency = 424
59 StatusTooEarly = 425
60 StatusUpgradeRequired = 426
61 StatusPreconditionRequired = 428
62 StatusTooManyRequests = 429
63 StatusRequestHeaderFieldsTooLarge = 431
64 StatusUnavailableForLegalReasons = 451
65
66 StatusInternalServerError = 500
67 StatusNotImplemented = 501
68 StatusBadGateway = 502
69 StatusServiceUnavailable = 503
70 StatusGatewayTimeout = 504
71 StatusHTTPVersionNotSupported = 505
72 StatusVariantAlsoNegotiates = 506
73 StatusInsufficientStorage = 507
74 StatusLoopDetected = 508
75 StatusNotExtended = 510
76 StatusNetworkAuthenticationRequired = 511
77 )
78
79 var statusText = map[int]string{
80 StatusContinue: "Continue",
81 StatusSwitchingProtocols: "Switching Protocols",
82 StatusProcessing: "Processing",
83 StatusEarlyHints: "Early Hints",
84
85 StatusOK: "OK",
86 StatusCreated: "Created",
87 StatusAccepted: "Accepted",
88 StatusNonAuthoritativeInfo: "Non-Authoritative Information",
89 StatusNoContent: "No Content",
90 StatusResetContent: "Reset Content",
91 StatusPartialContent: "Partial Content",
92 StatusMultiStatus: "Multi-Status",
93 StatusAlreadyReported: "Already Reported",
94 StatusIMUsed: "IM Used",
95
96 StatusMultipleChoices: "Multiple Choices",
97 StatusMovedPermanently: "Moved Permanently",
98 StatusFound: "Found",
99 StatusSeeOther: "See Other",
100 StatusNotModified: "Not Modified",
101 StatusUseProxy: "Use Proxy",
102 StatusTemporaryRedirect: "Temporary Redirect",
103 StatusPermanentRedirect: "Permanent Redirect",
104
105 StatusBadRequest: "Bad Request",
106 StatusUnauthorized: "Unauthorized",
107 StatusPaymentRequired: "Payment Required",
108 StatusForbidden: "Forbidden",
109 StatusNotFound: "Not Found",
110 StatusMethodNotAllowed: "Method Not Allowed",
111 StatusNotAcceptable: "Not Acceptable",
112 StatusProxyAuthRequired: "Proxy Authentication Required",
113 StatusRequestTimeout: "Request Timeout",
114 StatusConflict: "Conflict",
115 StatusGone: "Gone",
116 StatusLengthRequired: "Length Required",
117 StatusPreconditionFailed: "Precondition Failed",
118 StatusRequestEntityTooLarge: "Request Entity Too Large",
119 StatusRequestURITooLong: "Request URI Too Long",
120 StatusUnsupportedMediaType: "Unsupported Media Type",
121 StatusRequestedRangeNotSatisfiable: "Requested Range Not Satisfiable",
122 StatusExpectationFailed: "Expectation Failed",
123 StatusTeapot: "I'm a teapot",
124 StatusMisdirectedRequest: "Misdirected Request",
125 StatusUnprocessableEntity: "Unprocessable Entity",
126 StatusLocked: "Locked",
127 StatusFailedDependency: "Failed Dependency",
128 StatusTooEarly: "Too Early",
129 StatusUpgradeRequired: "Upgrade Required",
130 StatusPreconditionRequired: "Precondition Required",
131 StatusTooManyRequests: "Too Many Requests",
132 StatusRequestHeaderFieldsTooLarge: "Request Header Fields Too Large",
133 StatusUnavailableForLegalReasons: "Unavailable For Legal Reasons",
134
135 StatusInternalServerError: "Internal Server Error",
136 StatusNotImplemented: "Not Implemented",
137 StatusBadGateway: "Bad Gateway",
138 StatusServiceUnavailable: "Service Unavailable",
139 StatusGatewayTimeout: "Gateway Timeout",
140 StatusHTTPVersionNotSupported: "HTTP Version Not Supported",
141 StatusVariantAlsoNegotiates: "Variant Also Negotiates",
142 StatusInsufficientStorage: "Insufficient Storage",
143 StatusLoopDetected: "Loop Detected",
144 StatusNotExtended: "Not Extended",
145 StatusNetworkAuthenticationRequired: "Network Authentication Required",
146 }
147
148
149
150 func StatusText(code int) string {
151 return statusText[code]
152 }
153
View as plain text