-
Notifications
You must be signed in to change notification settings - Fork 1
/
context_status.go
295 lines (236 loc) · 8.52 KB
/
context_status.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
package zoox
import (
"net/http"
)
// StatusOK sets the response status code to 200.
func (ctx *Context) StatusOK() {
ctx.Status(http.StatusOK)
}
// StatusCreated sets the response status code to 201.
func (ctx *Context) StatusCreated() {
ctx.Status(http.StatusCreated)
}
// StatusAccepted sets the response status code to 202.
func (ctx *Context) StatusAccepted() {
ctx.Status(http.StatusAccepted)
}
// StatusNonAuthoritativeInfo sets the response status code to 203.
func (ctx *Context) StatusNonAuthoritativeInfo() {
ctx.Status(http.StatusNonAuthoritativeInfo)
}
// StatusNoContent sets the response status code to 204.
func (ctx *Context) StatusNoContent() {
ctx.Status(http.StatusNoContent)
}
// StatusResetContent sets the response status code to 205.
func (ctx *Context) StatusResetContent() {
ctx.Status(http.StatusResetContent)
}
// StatusPartialContent sets the response status code to 206.
func (ctx *Context) StatusPartialContent() {
ctx.Status(http.StatusPartialContent)
}
// StatusMultiStatus sets the response status code to 207.
func (ctx *Context) StatusMultiStatus() {
ctx.Status(http.StatusMultiStatus)
}
// StatusAlreadyReported sets the response status code to 208.
func (ctx *Context) StatusAlreadyReported() {
ctx.Status(http.StatusAlreadyReported)
}
// StatusIMUsed sets the response status code to 226.
func (ctx *Context) StatusIMUsed() {
ctx.Status(http.StatusIMUsed)
}
// StatusMultipleChoices sets the response status code to 300.
func (ctx *Context) StatusMultipleChoices() {
ctx.Status(http.StatusMultipleChoices)
}
// StatusMovedPermanently sets the response status code to 301.
func (ctx *Context) StatusMovedPermanently() {
ctx.Status(http.StatusMovedPermanently)
}
// StatusFound sets the response status code to 302.
func (ctx *Context) StatusFound() {
ctx.Status(http.StatusFound)
}
// StatusSeeOther sets the response status code to 303.
func (ctx *Context) StatusSeeOther() {
ctx.Status(http.StatusSeeOther)
}
// StatusNotModified sets the response status code to 304.
func (ctx *Context) StatusNotModified() {
ctx.Status(http.StatusNotModified)
}
// StatusUseProxy sets the response status code to 305.
func (ctx *Context) StatusUseProxy() {
ctx.Status(http.StatusUseProxy)
}
// StatusTemporaryRedirect sets the response status code to 307.
func (ctx *Context) StatusTemporaryRedirect() {
ctx.Status(http.StatusTemporaryRedirect)
}
// StatusPermanentRedirect sets the response status code to 308.
func (ctx *Context) StatusPermanentRedirect() {
ctx.Status(http.StatusPermanentRedirect)
}
// StatusBadRequest sets the response status code to 400.
func (ctx *Context) StatusBadRequest() {
ctx.Status(http.StatusBadRequest)
}
// StatusUnauthorized sets the response status code to 401.
func (ctx *Context) StatusUnauthorized() {
ctx.Status(http.StatusUnauthorized)
}
// StatusPaymentRequired sets the response status code to 402.
func (ctx *Context) StatusPaymentRequired() {
ctx.Status(http.StatusPaymentRequired)
}
// StatusForbidden sets the response status code to 403.
func (ctx *Context) StatusForbidden() {
ctx.Status(http.StatusForbidden)
}
// StatusNotFound sets the response status code to 404.
func (ctx *Context) StatusNotFound() {
ctx.Status(http.StatusNotFound)
}
// StatusMethodNotAllowed sets the response status code to 405.
func (ctx *Context) StatusMethodNotAllowed() {
ctx.Status(http.StatusMethodNotAllowed)
}
// StatusNotAcceptable sets the response status code to 406.
func (ctx *Context) StatusNotAcceptable() {
ctx.Status(http.StatusNotAcceptable)
}
// StatusProxyAuthRequired sets the response status code to 407.
func (ctx *Context) StatusProxyAuthRequired() {
ctx.Status(http.StatusProxyAuthRequired)
}
// StatusRequestTimeout sets the response status code to 408.
func (ctx *Context) StatusRequestTimeout() {
ctx.Status(http.StatusRequestTimeout)
}
// StatusConflict sets the response status code to 409.
func (ctx *Context) StatusConflict() {
ctx.Status(http.StatusConflict)
}
// StatusGone sets the response status code to 410.
func (ctx *Context) StatusGone() {
ctx.Status(http.StatusGone)
}
// StatusLengthRequired sets the response status code to 411.
func (ctx *Context) StatusLengthRequired() {
ctx.Status(http.StatusLengthRequired)
}
// StatusPreconditionFailed sets the response status code to 412.
func (ctx *Context) StatusPreconditionFailed() {
ctx.Status(http.StatusPreconditionFailed)
}
// StatusRequestEntityTooLarge sets the response status code to 413.
func (ctx *Context) StatusRequestEntityTooLarge() {
ctx.Status(http.StatusRequestEntityTooLarge)
}
// StatusRequestURITooLong sets the response status code to 414.
func (ctx *Context) StatusRequestURITooLong() {
ctx.Status(http.StatusRequestURITooLong)
}
// StatusUnsupportedMediaType sets the response status code to 415.
func (ctx *Context) StatusUnsupportedMediaType() {
ctx.Status(http.StatusUnsupportedMediaType)
}
// StatusRequestedRangeNotSatisfiable sets the response status code to 416.
func (ctx *Context) StatusRequestedRangeNotSatisfiable() {
ctx.Status(http.StatusRequestedRangeNotSatisfiable)
}
// StatusExpectationFailed sets the response status code to 417.
func (ctx *Context) StatusExpectationFailed() {
ctx.Status(http.StatusExpectationFailed)
}
// StatusTeapot sets the response status code to 418.
func (ctx *Context) StatusTeapot() {
ctx.Status(http.StatusTeapot)
}
// StatusMisdirectedRequest sets the response status code to 421.
func (ctx *Context) StatusMisdirectedRequest() {
ctx.Status(http.StatusMisdirectedRequest)
}
// StatusUnprocessableEntity sets the response status code to 422.
func (ctx *Context) StatusUnprocessableEntity() {
ctx.Status(http.StatusUnprocessableEntity)
}
// StatusLocked sets the response status code to 423.
func (ctx *Context) StatusLocked() {
ctx.Status(http.StatusLocked)
}
// StatusFailedDependency sets the response status code to 424.
func (ctx *Context) StatusFailedDependency() {
ctx.Status(http.StatusFailedDependency)
}
// StatusTooEarly sets the response status code to 425.
func (ctx *Context) StatusTooEarly() {
ctx.Status(http.StatusTooEarly)
}
// StatusUpgradeRequired sets the response status code to 426.
func (ctx *Context) StatusUpgradeRequired() {
ctx.Status(http.StatusUpgradeRequired)
}
// StatusPreconditionRequired sets the response status code to 428.
func (ctx *Context) StatusPreconditionRequired() {
ctx.Status(http.StatusPreconditionRequired)
}
// StatusTooManyRequests sets the response status code to 429.
func (ctx *Context) StatusTooManyRequests() {
ctx.Status(http.StatusTooManyRequests)
}
// StatusRequestHeaderFieldsTooLarge sets the response status code to 431.
func (ctx *Context) StatusRequestHeaderFieldsTooLarge() {
ctx.Status(http.StatusRequestHeaderFieldsTooLarge)
}
// StatusUnavailableForLegalReasons sets the response status code to 451.
func (ctx *Context) StatusUnavailableForLegalReasons() {
ctx.Status(http.StatusUnavailableForLegalReasons)
}
// StatusInternalServerError sets the response status code to 500.
func (ctx *Context) StatusInternalServerError() {
ctx.Status(http.StatusInternalServerError)
}
// StatusNotImplemented sets the response status code to 501.
func (ctx *Context) StatusNotImplemented() {
ctx.Status(http.StatusNotImplemented)
}
// StatusBadGateway sets the response status code to 502.
func (ctx *Context) StatusBadGateway() {
ctx.Status(http.StatusBadGateway)
}
// StatusServiceUnavailable sets the response status code to 503.
func (ctx *Context) StatusServiceUnavailable() {
ctx.Status(http.StatusServiceUnavailable)
}
// StatusGatewayTimeout sets the response status code to 504.
func (ctx *Context) StatusGatewayTimeout() {
ctx.Status(http.StatusGatewayTimeout)
}
// StatusHTTPVersionNotSupported sets the response status code to 505.
func (ctx *Context) StatusHTTPVersionNotSupported() {
ctx.Status(http.StatusHTTPVersionNotSupported)
}
// StatusVariantAlsoNegotiates sets the response status code to 506.
func (ctx *Context) StatusVariantAlsoNegotiates() {
ctx.Status(http.StatusVariantAlsoNegotiates)
}
// StatusInsufficientStorage sets the response status code to 507.
func (ctx *Context) StatusInsufficientStorage() {
ctx.Status(http.StatusInsufficientStorage)
}
// StatusLoopDetected sets the response status code to 508.
func (ctx *Context) StatusLoopDetected() {
ctx.Status(http.StatusLoopDetected)
}
// StatusNotExtended sets the response status code to 510.
func (ctx *Context) StatusNotExtended() {
ctx.Status(http.StatusNotExtended)
}
// StatusNetworkAuthenticationRequired sets the response status code to 511.
func (ctx *Context) StatusNetworkAuthenticationRequired() {
ctx.Status(http.StatusNetworkAuthenticationRequired)
}