-
Notifications
You must be signed in to change notification settings - Fork 0
/
header_const.go
158 lines (150 loc) · 4.61 KB
/
header_const.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
package facio
type header uint
// All HTTP Headers
const (
// Standard Headers
// https://datatracker.ietf.org/doc/html/rfc3229#page-33
AIM header = iota // A-IM Header
Accept // Accept Header
//AcceptCharset // Accept-Charset Header
AcceptEncoding // Accept-Encoding Header
AcceptLanguage // Accept-Language Header
AcceptDatetime // Accept-Datetime Header
AccessControlAllowCredentials // Access-Control-Allow-Credentials Header
AccessControlAllowHeaders // Access-Control-Allow-Headers Header
AccessControlAllowMethods // Access-Control-Allow-Methods Header
AccessControlAllowOrigin // Access-Control-Allow-Origin Header
AccessControlExposeHeaders // Access-Control-Expose-Headers Header
AccessControlMaxAge // Access-Control-Max-Age Header
AccessControlRequestMethod // Access-Control-Request-Method Header
AccessControlRequestHeaders // Access-Control-Request-Headers Header
Authorization // Authorization Header
CacheControl // Cache-Control Header
Connection // Connection Header
ContentLength // Content-Length Header
ContentType // Content-Type Header
Cookie // Cookie Header
Date // Date Header
Expect // Expect Header
Forwarded // Forwarded Header
From // From Header
Host // Host Header
IfMatch // If-Match Header
IfModifiedSince // If-Modified-Since Header
IfNoneMatch // If-None-Match Header
IfRange // If-Range Header
IfUnmodifiedSince // If-Unmodified-Since Header
MaxForwards // Max-Forwards Header
Origin // Origin Header
Pragma // Pragma Header
ProxyAuthorization // Proxy-Authorization Header
Range // Range Header
Referer // Referer Header
TE // TE Header
UserAgent // User-Agent Header
Upgrade // Upgrade Header
Via // Via Header
Warning // Warning Header
// Non-standard Headers
Dnt // Dnt Header
XRequestedWith // X-Requested-With Header
XCSRFToken // X-CSRF-Token Header
rand_header // some value for test purposes
)
// Return the header name as string
func (h header) getHeader() string {
switch h {
// Standard Headers
case AIM:
return "A-IM"
case Accept:
return "Accept"
//case AcceptCharset:
//return "Accept-Charset"
case AcceptEncoding:
return "Accept-Encoding"
case AcceptLanguage:
return "Accept-Language"
case AcceptDatetime:
return "Accept-Datetime"
case AccessControlAllowCredentials:
return "Access-Control-Allow-Credentials"
case AccessControlAllowHeaders:
return "Access-Control-Allow-Headers"
case AccessControlAllowMethods:
return "Access-Control-Allow-Methods"
case AccessControlAllowOrigin:
return "Access-Control-Allow-Origin"
case AccessControlExposeHeaders:
return "Access-Control-Expose-Headers"
case AccessControlMaxAge:
return "Access-Control-Max-Age"
case AccessControlRequestMethod:
return "Access-Control-Request-Method"
case AccessControlRequestHeaders:
return "Access-Control-Request-Headers"
case Authorization:
return "Authorization"
case CacheControl:
return "Cache-Control"
case Connection:
return "Connection"
case ContentLength:
return "Content-Length"
case ContentType:
return "Content-Type"
case Cookie:
return "Cookie"
case Date:
return "Date"
case Expect:
return "Expect"
case Forwarded:
return "Forwarded"
case From:
return "From"
case Host:
return "Host"
case IfMatch:
return "If-Match"
case IfModifiedSince:
return "If-Modified-Since"
case IfNoneMatch:
return "If-None-Match"
case IfRange:
return "If-Range"
case IfUnmodifiedSince:
return "If-Unmodified-Since"
case MaxForwards:
return "Max-Forwards"
case Origin:
return "Origin"
case Pragma:
return "Pragma"
case ProxyAuthorization:
return "Proxy-Authorization"
case Range:
return "Range"
case Referer:
return "Referer"
case TE:
return "TE"
case UserAgent:
return "User-Agent"
case Upgrade:
return "Upgrade"
case Via:
return "Via"
case Warning:
return "Warning"
// Non-standard Headers
case Dnt:
return "Dnt"
case XRequestedWith:
return "X-Requested-With"
case XCSRFToken:
return "X-CSRF-Token"
default:
return ""
}
}