Skip to content

Commit 67c910f

Browse files
committed
add headers
1 parent 6498460 commit 67c910f

File tree

2 files changed

+110
-1
lines changed

2 files changed

+110
-1
lines changed

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,31 @@
1-
# headers
1+
# headers
2+
3+
HTTP header constants for Gophers.
4+
5+
## Installation
6+
7+
```sh
8+
go get -u github.com/go-http-utils/headers
9+
```
10+
11+
## Documentation
12+
13+
https://godoc.org/github.com/go-http-utils/headers
14+
15+
## Usage
16+
17+
```go
18+
impost (
19+
"fmt"
20+
21+
"github.com/DavidCai1993/headers"
22+
)
23+
24+
fmt.Println(headers.HeaderAcceptCharset)
25+
// -> "Accept-Charset"
26+
27+
fmt.Println(headers.HeaderIfNoneMatch)
28+
// -> "If-None-Match"
29+
30+
// ...
31+
```

headers.go

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package headers
2+
3+
// HTTP headers
4+
const (
5+
HeaderAccept = "Accept"
6+
HeaderAcceptCharset = "Accept-Charset"
7+
HeaderAcceptEncoding = "Accept-Encoding"
8+
HeaderAcceptLanguage = "Accept-Language"
9+
HeaderAuthorization = "Authorization"
10+
HeaderCacheControl = "Cache-Control"
11+
HeaderContentLength = "Content-Length"
12+
HeaderContentMD5 = "Content-MD5"
13+
HeaderContentType = "Content-Type"
14+
HeaderIfMatch = "If-Match"
15+
HeaderIfModifiedSince = "If-Modified-Since"
16+
HeaderIfNoneMatch = "If-None-Match"
17+
HeaderIfRange = "If-Range"
18+
HeaderIfUnmodifiedSince = "If-Unmodified-Since"
19+
HeaderMaxForwards = "Max-Forwards"
20+
HeaderProxyAuthorization = "Proxy-Authorization"
21+
HeaderPragma = "Pragma"
22+
HeaderRange = "Range"
23+
HeaderReferer = "Referer"
24+
HeaderUserAgent = "User-Agent"
25+
HeaderTE = "TE"
26+
HeaderVia = "Via"
27+
HeaderWarning = "Warning"
28+
HeaderCookie = "Cookie"
29+
HeaderOrigin = "Origin"
30+
HeaderAcceptDatetime = "Accept-Datetime"
31+
HeaderXRequestedWith = "X-Requested-With"
32+
HeaderAccessControlAllowOrigin = "Access-Control-Allow-Origin"
33+
HeaderAccessControlAllowMethods = "Access-Control-Allow-Methods"
34+
HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers"
35+
HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials"
36+
HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers"
37+
HeaderAccessControlMaxAge = "Access-Control-Max-Age"
38+
HeaderAccessControlRequestMethod = "Access-Control-Request-Method"
39+
HeaderAccessControlRequestHeaders = "Access-Control-Request-Headers"
40+
HeaderAcceptPatch = "Accept-Patch"
41+
HeaderAcceptRanges = "Accept-Ranges"
42+
HeaderAllow = "Allow"
43+
HeaderContentEncoding = "Content-Encoding"
44+
HeaderContentLanguage = "Content-Language"
45+
HeaderContentLocation = "Content-Location"
46+
HeaderContentDisposition = "Content-Disposition"
47+
HeaderContentRange = "Content-Range"
48+
HeaderETag = "ETag"
49+
HeaderExpires = "Expires"
50+
HeaderLastModified = "Last-Modified"
51+
HeaderLink = "Link"
52+
HeaderLocation = "Location"
53+
HeaderP3P = "P3P"
54+
HeaderProxyAuthenticate = "Proxy-Authenticate"
55+
HeaderRefresh = "Refresh"
56+
HeaderRetryAfter = "Retry-After"
57+
HeaderServer = "Server"
58+
HeaderSetCookie = "Set-Cookie"
59+
HeaderStrictTransportSecurity = "Strict-Transport-Security"
60+
HeaderTransferEncoding = "Transfer-Encoding"
61+
HeaderUpgrade = "Upgrade"
62+
HeaderVary = "Vary"
63+
HeaderWWWAuthenticate = "WWW-Authenticate"
64+
65+
// Non-Standard
66+
HeaderXFrameOptions = "X-Frame-Options"
67+
HeaderXXSSProtection = "X-XSS-Protection"
68+
HeaderContentSecurityPolicy = "Content-Security-Policy"
69+
HeaderXContentSecurityPolicy = "X-Content-Security-Policy"
70+
HeaderXWebKitCSP = "X-WebKit-CSP"
71+
HeaderXContentTypeOptions = "X-Content-Type-Options"
72+
HeaderXPoweredBy = "X-Powered-By"
73+
HeaderXUACompatible = "X-UA-Compatible"
74+
HeaderXForwardedProto = "X-Forwarded-Proto"
75+
HeaderXHTTPMethodOverride = "X-HTTP-Method-Override"
76+
HeaderXForwardedFor = "X-Forwarded-For"
77+
HeaderXRealIP = "X-Real-IP"
78+
HeaderXCSRFToken = "X-CSRF-Token"
79+
)

0 commit comments

Comments
 (0)