πŸ“‹
Constants
Some constants for Fiber.
HTTP methods were copied from net/http.
1
const (
2
MethodGet = "GET" // RFC 7231, 4.3.1
3
MethodHead = "HEAD" // RFC 7231, 4.3.2
4
MethodPost = "POST" // RFC 7231, 4.3.3
5
MethodPut = "PUT" // RFC 7231, 4.3.4
6
MethodPatch = "PATCH" // RFC 5789
7
MethodDelete = "DELETE" // RFC 7231, 4.3.5
8
MethodConnect = "CONNECT" // RFC 7231, 4.3.6
9
MethodOptions = "OPTIONS" // RFC 7231, 4.3.7
10
MethodTrace = "TRACE" // RFC 7231, 4.3.8
11
methodUse = "USE"
12
)
Copied!
MIME types that are commonly used
1
const (
2
MIMETextXML = "text/xml"
3
MIMETextHTML = "text/html"
4
MIMETextPlain = "text/plain"
5
MIMEApplicationXML = "application/xml"
6
MIMEApplicationJSON = "application/json"
7
MIMEApplicationJavaScript = "application/javascript"
8
MIMEApplicationForm = "application/x-www-form-urlencoded"
9
MIMEOctetStream = "application/octet-stream"
10
MIMEMultipartForm = "multipart/form-data"
11
​
12
MIMETextXMLCharsetUTF8 = "text/xml; charset=utf-8"
13
MIMETextHTMLCharsetUTF8 = "text/html; charset=utf-8"
14
MIMETextPlainCharsetUTF8 = "text/plain; charset=utf-8"
15
MIMEApplicationXMLCharsetUTF8 = "application/xml; charset=utf-8"
16
MIMEApplicationJSONCharsetUTF8 = "application/json; charset=utf-8"
17
MIMEApplicationJavaScriptCharsetUTF8 = "application/javascript; charset=utf-8"
18
)
Copied!
HTTP status codes were copied from net/http.
1
const (
2
StatusContinue = 100 // RFC 7231, 6.2.1
3
StatusSwitchingProtocols = 101 // RFC 7231, 6.2.2
4
StatusProcessing = 102 // RFC 2518, 10.1
5
StatusEarlyHints = 103 // RFC 8297
6
StatusOK = 200 // RFC 7231, 6.3.1
7
StatusCreated = 201 // RFC 7231, 6.3.2
8
StatusAccepted = 202 // RFC 7231, 6.3.3
9
StatusNonAuthoritativeInfo = 203 // RFC 7231, 6.3.4
10
StatusNoContent = 204 // RFC 7231, 6.3.5
11
StatusResetContent = 205 // RFC 7231, 6.3.6
12
StatusPartialContent = 206 // RFC 7233, 4.1
13
StatusMultiStatus = 207 // RFC 4918, 11.1
14
StatusAlreadyReported = 208 // RFC 5842, 7.1
15
StatusIMUsed = 226 // RFC 3229, 10.4.1
16
StatusMultipleChoices = 300 // RFC 7231, 6.4.1
17
StatusMovedPermanently = 301 // RFC 7231, 6.4.2
18
StatusFound = 302 // RFC 7231, 6.4.3
19
StatusSeeOther = 303 // RFC 7231, 6.4.4
20
StatusNotModified = 304 // RFC 7232, 4.1
21
StatusUseProxy = 305 // RFC 7231, 6.4.5
22
StatusTemporaryRedirect = 307 // RFC 7231, 6.4.7
23
StatusPermanentRedirect = 308 // RFC 7538, 3
24
StatusBadRequest = 400 // RFC 7231, 6.5.1
25
StatusUnauthorized = 401 // RFC 7235, 3.1
26
StatusPaymentRequired = 402 // RFC 7231, 6.5.2
27
StatusForbidden = 403 // RFC 7231, 6.5.3
28
StatusNotFound = 404 // RFC 7231, 6.5.4
29
StatusMethodNotAllowed = 405 // RFC 7231, 6.5.5
30
StatusNotAcceptable = 406 // RFC 7231, 6.5.6
31
StatusProxyAuthRequired = 407 // RFC 7235, 3.2
32
StatusRequestTimeout = 408 // RFC 7231, 6.5.7
33
StatusConflict = 409 // RFC 7231, 6.5.8
34
StatusGone = 410 // RFC 7231, 6.5.9
35
StatusLengthRequired = 411 // RFC 7231, 6.5.10
36
StatusPreconditionFailed = 412 // RFC 7232, 4.2
37
StatusRequestEntityTooLarge = 413 // RFC 7231, 6.5.11
38
StatusRequestURITooLong = 414 // RFC 7231, 6.5.12
39
StatusUnsupportedMediaType = 415 // RFC 7231, 6.5.13
40
StatusRequestedRangeNotSatisfiable = 416 // RFC 7233, 4.4
41
StatusExpectationFailed = 417 // RFC 7231, 6.5.14
42
StatusTeapot = 418 // RFC 7168, 2.3.3
43
StatusMisdirectedRequest = 421 // RFC 7540, 9.1.2
44
StatusUnprocessableEntity = 422 // RFC 4918, 11.2
45
StatusLocked = 423 // RFC 4918, 11.3
46
StatusFailedDependency = 424 // RFC 4918, 11.4
47
StatusTooEarly = 425 // RFC 8470, 5.2.
48
StatusUpgradeRequired = 426 // RFC 7231, 6.5.15
49
StatusPreconditionRequired = 428 // RFC 6585, 3
50
StatusTooManyRequests = 429 // RFC 6585, 4
51
StatusRequestHeaderFieldsTooLarge = 431 // RFC 6585, 5
52
StatusUnavailableForLegalReasons = 451 // RFC 7725, 3
53
StatusInternalServerError = 500 // RFC 7231, 6.6.1
54
StatusNotImplemented = 501 // RFC 7231, 6.6.2
55
StatusBadGateway = 502 // RFC 7231, 6.6.3
56
StatusServiceUnavailable = 503 // RFC 7231, 6.6.4
57
StatusGatewayTimeout = 504 // RFC 7231, 6.6.5
58
StatusHTTPVersionNotSupported = 505 // RFC 7231, 6.6.6
59
StatusVariantAlsoNegotiates = 506 // RFC 2295, 8.1
60
StatusInsufficientStorage = 507 // RFC 4918, 11.5
61
StatusLoopDetected = 508 // RFC 5842, 7.2
62
StatusNotExtended = 510 // RFC 2774, 7
63
StatusNetworkAuthenticationRequired = 511 // RFC 6585, 6
64
)
Copied!
Errors
1
var (
2
ErrContinue = NewError(StatusContinue) // RFC 7231, 6.2.1
3
ErrSwitchingProtocols = NewError(StatusSwitchingProtocols) // RFC 7231, 6.2.2
4
ErrProcessing = NewError(StatusProcessing) // RFC 2518, 10.1
5
ErrEarlyHints = NewError(StatusEarlyHints) // RFC 8297
6
ErrOK = NewError(StatusOK) // RFC 7231, 6.3.1
7
ErrCreated = NewError(StatusCreated) // RFC 7231, 6.3.2
8
ErrAccepted = NewError(StatusAccepted) // RFC 7231, 6.3.3
9
ErrNonAuthoritativeInfo = NewError(StatusNonAuthoritativeInfo) // RFC 7231, 6.3.4
10
ErrNoContent = NewError(StatusNoContent) // RFC 7231, 6.3.5
11
ErrResetContent = NewError(StatusResetContent) // RFC 7231, 6.3.6
12
ErrPartialContent = NewError(StatusPartialContent) // RFC 7233, 4.1
13
ErrMultiStatus = NewError(StatusMultiStatus) // RFC 4918, 11.1
14
ErrAlreadyReported = NewError(StatusAlreadyReported) // RFC 5842, 7.1
15
ErrIMUsed = NewError(StatusIMUsed) // RFC 3229, 10.4.1
16
ErrMultipleChoices = NewError(StatusMultipleChoices) // RFC 7231, 6.4.1
17
ErrMovedPermanently = NewError(StatusMovedPermanently) // RFC 7231, 6.4.2
18
ErrFound = NewError(StatusFound) // RFC 7231, 6.4.3
19
ErrSeeOther = NewError(StatusSeeOther) // RFC 7231, 6.4.4
20
ErrNotModified = NewError(StatusNotModified) // RFC 7232, 4.1
21
ErrUseProxy = NewError(StatusUseProxy) // RFC 7231, 6.4.5
22
ErrTemporaryRedirect = NewError(StatusTemporaryRedirect) // RFC 7231, 6.4.7
23
ErrPermanentRedirect = NewError(StatusPermanentRedirect) // RFC 7538, 3
24
ErrBadRequest = NewError(StatusBadRequest) // RFC 7231, 6.5.1
25
ErrUnauthorized = NewError(StatusUnauthorized) // RFC 7235, 3.1
26
ErrPaymentRequired = NewError(StatusPaymentRequired) // RFC 7231, 6.5.2
27
ErrForbidden = NewError(StatusForbidden) // RFC 7231, 6.5.3
28
ErrNotFound = NewError(StatusNotFound) // RFC 7231, 6.5.4
29
ErrMethodNotAllowed = NewError(StatusMethodNotAllowed) // RFC 7231, 6.5.5
30
ErrNotAcceptable = NewError(StatusNotAcceptable) // RFC 7231, 6.5.6
31
ErrProxyAuthRequired = NewError(StatusProxyAuthRequired) // RFC 7235, 3.2
32
ErrRequestTimeout = NewError(StatusRequestTimeout) // RFC 7231, 6.5.7
33
ErrConflict = NewError(StatusConflict) // RFC 7231, 6.5.8
34
ErrGone = NewError(StatusGone) // RFC 7231, 6.5.9
35
ErrLengthRequired = NewError(StatusLengthRequired) // RFC 7231, 6.5.10
36
ErrPreconditionFailed = NewError(StatusPreconditionFailed) // RFC 7232, 4.2
37
ErrRequestEntityTooLarge = NewError(StatusRequestEntityTooLarge) // RFC 7231, 6.5.11
38
ErrRequestURITooLong = NewError(StatusRequestURITooLong) // RFC 7231, 6.5.12
39
ErrUnsupportedMediaType = NewError(StatusUnsupportedMediaType) // RFC 7231, 6.5.13
40
ErrRequestedRangeNotSatisfiable = NewError(StatusRequestedRangeNotSatisfiable) // RFC 7233, 4.4
41
ErrExpectationFailed = NewError(StatusExpectationFailed) // RFC 7231, 6.5.14
42
ErrTeapot = NewError(StatusTeapot) // RFC 7168, 2.3.3
43
ErrMisdirectedRequest = NewError(StatusMisdirectedRequest) // RFC 7540, 9.1.2
44
ErrUnprocessableEntity = NewError(StatusUnprocessableEntity) // RFC 4918, 11.2
45
ErrLocked = NewError(StatusLocked) // RFC 4918, 11.3
46
ErrFailedDependency = NewError(StatusFailedDependency) // RFC 4918, 11.4
47
ErrTooEarly = NewError(StatusTooEarly) // RFC 8470, 5.2.
48
ErrUpgradeRequired = NewError(StatusUpgradeRequired) // RFC 7231, 6.5.15
49
ErrPreconditionRequired = NewError(StatusPreconditionRequired) // RFC 6585, 3
50
ErrTooManyRequests = NewError(StatusTooManyRequests) // RFC 6585, 4
51
ErrRequestHeaderFieldsTooLarge = NewError(StatusRequestHeaderFieldsTooLarge) // RFC 6585, 5
52
ErrUnavailableForLegalReasons = NewError(StatusUnavailableForLegalReasons) // RFC 7725, 3
53
ErrInternalServerError = NewError(StatusInternalServerError) // RFC 7231, 6.6.1
54
ErrNotImplemented = NewError(StatusNotImplemented) // RFC 7231, 6.6.2
55
ErrBadGateway = NewError(StatusBadGateway) // RFC 7231, 6.6.3
56
ErrServiceUnavailable = NewError(StatusServiceUnavailable) // RFC 7231, 6.6.4
57
ErrGatewayTimeout = NewError(StatusGatewayTimeout) // RFC 7231, 6.6.5
58
ErrHTTPVersionNotSupported = NewError(StatusHTTPVersionNotSupported) // RFC 7231, 6.6.6
59
ErrVariantAlsoNegotiates = NewError(StatusVariantAlsoNegotiates) // RFC 2295, 8.1
60
ErrInsufficientStorage = NewError(StatusInsufficientStorage) // RFC 4918, 11.5
61
ErrLoopDetected = NewError(StatusLoopDetected) // RFC 5842, 7.2
62
ErrNotExtended = NewError(StatusNotExtended) // RFC 2774, 7
63
ErrNetworkAuthenticationRequired = NewError(StatusNetworkAuthenticationRequired) // RFC 6585, 6
64
)
Copied!
HTTP Headers were copied from net/http.
1
const (
2
HeaderAuthorization = "Authorization"
3
HeaderProxyAuthenticate = "Proxy-Authenticate"
4
HeaderProxyAuthorization = "Proxy-Authorization"
5
HeaderWWWAuthenticate = "WWW-Authenticate"
6
HeaderAge = "Age"
7
HeaderCacheControl = "Cache-Control"
8
HeaderClearSiteData = "Clear-Site-Data"
9
HeaderExpires = "Expires"
10
HeaderPragma = "Pragma"
11
HeaderWarning = "Warning"
12
HeaderAcceptCH = "Accept-CH"
13
HeaderAcceptCHLifetime = "Accept-CH-Lifetime"
14
HeaderContentDPR = "Content-DPR"
15
HeaderDPR = "DPR"
16
HeaderEarlyData = "Early-Data"
17
HeaderSaveData = "Save-Data"
18
HeaderViewportWidth = "Viewport-Width"
19
HeaderWidth = "Width"
20
HeaderETag = "ETag"
21
HeaderIfMatch = "If-Match"
22
HeaderIfModifiedSince = "If-Modified-Since"
23
HeaderIfNoneMatch = "If-None-Match"
24
HeaderIfUnmodifiedSince = "If-Unmodified-Since"
25
HeaderLastModified = "Last-Modified"
26
HeaderVary = "Vary"
27
HeaderConnection = "Connection"
28
HeaderKeepAlive = "Keep-Alive"
29
HeaderAccept = "Accept"
30
HeaderAcceptCharset = "Accept-Charset"
31
HeaderAcceptEncoding = "Accept-Encoding"
32
HeaderAcceptLanguage = "Accept-Language"
33
HeaderCookie = "Cookie"
34
HeaderExpect = "Expect"
35
HeaderMaxForwards = "Max-Forwards"
36
HeaderSetCookie = "Set-Cookie"
37
HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials"
38
HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers"
39
HeaderAccessControlAllowMethods = "Access-Control-Allow-Methods"
40
HeaderAccessControlAllowOrigin = "Access-Control-Allow-Origin"
41
HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers"
42
HeaderAccessControlMaxAge = "Access-Control-Max-Age"
43
HeaderAccessControlRequestHeaders = "Access-Control-Request-Headers"
44
HeaderAccessControlRequestMethod = "Access-Control-Request-Method"
45
HeaderOrigin = "Origin"
46
HeaderTimingAllowOrigin = "Timing-Allow-Origin"
47
HeaderXPermittedCrossDomainPolicies = "X-Permitted-Cross-Domain-Policies"
48
HeaderDNT = "DNT"
49
HeaderTk = "Tk"
50
HeaderContentDisposition = "Content-Disposition"
51
HeaderContentEncoding = "Content-Encoding"
52
HeaderContentLanguage = "Content-Language"
53
HeaderContentLength = "Content-Length"
54
HeaderContentLocation = "Content-Location"
55
HeaderContentType = "Content-Type"
56
HeaderForwarded = "Forwarded"
57
HeaderVia = "Via"
58
HeaderXForwardedFor = "X-Forwarded-For"
59
HeaderXForwardedHost = "X-Forwarded-Host"
60
HeaderXForwardedProto = "X-Forwarded-Proto"
61
HeaderXForwardedProtocol = "X-Forwarded-Protocol"
62
HeaderXForwardedSsl = "X-Forwarded-Ssl"
63
HeaderXUrlScheme = "X-Url-Scheme"
64
HeaderLocation = "Location"
65
HeaderFrom = "From"
66
HeaderHost = "Host"
67
HeaderReferer = "Referer"
68
HeaderReferrerPolicy = "Referrer-Policy"
69
HeaderUserAgent = "User-Agent"
70
HeaderAllow = "Allow"
71
HeaderServer = "Server"
72
HeaderAcceptRanges = "Accept-Ranges"
73
HeaderContentRange = "Content-Range"
74
HeaderIfRange = "If-Range"
75
HeaderRange = "Range"
76
HeaderContentSecurityPolicy = "Content-Security-Policy"
77
HeaderContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only"
78
HeaderCrossOriginResourcePolicy = "Cross-Origin-Resource-Policy"
79
HeaderExpectCT = "Expect-CT"
80
HeaderFeaturePolicy = "Feature-Policy"
81
HeaderPublicKeyPins = "Public-Key-Pins"
82
HeaderPublicKeyPinsReportOnly = "Public-Key-Pins-Report-Only"
83
HeaderStrictTransportSecurity = "Strict-Transport-Security"
84
HeaderUpgradeInsecureRequests = "Upgrade-Insecure-Requests"
85
HeaderXContentTypeOptions = "X-Content-Type-Options"
86
HeaderXDownloadOptions = "X-Download-Options"
87
HeaderXFrameOptions = "X-Frame-Options"
88
HeaderXPoweredBy = "X-Powered-By"
89
HeaderXXSSProtection = "X-XSS-Protection"
90
HeaderLastEventID = "Last-Event-ID"
91
HeaderNEL = "NEL"
92
HeaderPingFrom = "Ping-From"
93
HeaderPingTo = "Ping-To"
94
HeaderReportTo = "Report-To"
95
HeaderTE = "TE"
96
HeaderTrailer = "Trailer"
97
HeaderTransferEncoding = "Transfer-Encoding"
98
HeaderSecWebSocketAccept = "Sec-WebSocket-Accept"
99
HeaderSecWebSocketExtensions = "Sec-WebSocket-Extensions"
100
HeaderSecWebSocketKey = "Sec-WebSocket-Key"
101
HeaderSecWebSocketProtocol = "Sec-WebSocket-Protocol"
102
HeaderSecWebSocketVersion = "Sec-WebSocket-Version"
103
HeaderAcceptPatch = "Accept-Patch"
104
HeaderAcceptPushPolicy = "Accept-Push-Policy"
105
HeaderAcceptSignature = "Accept-Signature"
106
HeaderAltSvc = "Alt-Svc"
107
HeaderDate = "Date"
108
HeaderIndex = "Index"
109
HeaderLargeAllocation = "Large-Allocation"
110
HeaderLink = "Link"
111
HeaderPushPolicy = "Push-Policy"
112
HeaderRetryAfter = "Retry-After"
113
HeaderServerTiming = "Server-Timing"
114
HeaderSignature = "Signature"
115
HeaderSignedHeaders = "Signed-Headers"
116
HeaderSourceMap = "SourceMap"
117
HeaderUpgrade = "Upgrade"
118
HeaderXDNSPrefetchControl = "X-DNS-Prefetch-Control"
119
HeaderXPingback = "X-Pingback"
120
HeaderXRequestID = "X-Request-ID"
121
HeaderXRequestedWith = "X-Requested-With"
122
HeaderXRobotsTag = "X-Robots-Tag"
123
HeaderXUACompatible = "X-UA-Compatible"
124
)
Copied!
Last modified 2mo ago
Copy link