Skip to content

Commit 9df7807

Browse files
author
Dean Karn
authored
Add http helper functions + constants (#1)
1 parent 1aa63b2 commit 9df7807

File tree

13 files changed

+947
-2
lines changed

13 files changed

+947
-2
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: go
22
go:
3-
- 1.12.4
3+
- 1.12.5
44
- tip
55
matrix:
66
allow_failures:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pkg
2-
![Project status](https://img.shields.io/badge/version-3.0.1-green.svg)
2+
![Project status](https://img.shields.io/badge/version-3.1.0-green.svg)
33
[![Build Status](https://travis-ci.org/go-playground/pkg.svg?branch=master)](https://travis-ci.org/go-playground/pkg)
44
[![Coverage Status](https://coveralls.io/repos/github/go-playground/pkg/badge.svg?branch=master)](https://coveralls.io/github/go-playground/pkg?branch=master)
55
[![GoDoc](https://godoc.org/github.com/go-playground/pkg?status.svg)](https://godoc.org/github.com/go-playground/pkg)

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
module github.com/go-playground/pkg
22

33
go 1.11
4+
5+
require (
6+
github.com/go-playground/form v3.1.4+incompatible
7+
gopkg.in/go-playground/assert.v1 v1.2.1
8+
)

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/go-playground/form v3.1.4+incompatible h1:lvKiHVxE2WvzDIoyMnWcjyiBxKt2+uFJyZcPYWsLnjI=
2+
github.com/go-playground/form v3.1.4+incompatible/go.mod h1:lhcKXfTuhRtIZCIKUeJ0b5F207aeQCPbZU09ScKjwWg=
3+
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
4+
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=

net/http/accept_encodings.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package httpext
2+
3+
// Accept-Encoding values
4+
const (
5+
Gzip string = "gzip"
6+
Compress string = "compress"
7+
Deflate string = "deflate"
8+
Br string = "br"
9+
Identity string = "identity"
10+
Any string = "*"
11+
)

net/http/charset.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package httpext
2+
3+
// Charset values
4+
const (
5+
UTF8 string = "utf-8"
6+
ISO88591 string = "iso-8859-1"
7+
)

net/http/form.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package httpext
2+
3+
import (
4+
"net/url"
5+
6+
"github.com/go-playground/form"
7+
)
8+
9+
// FormDecoder is the type used for decoding a form for use
10+
type FormDecoder interface {
11+
Decode(interface{}, url.Values) error
12+
}
13+
14+
var (
15+
// DefaultDecoder of this package, which is configurable
16+
DefaultDecoder FormDecoder = form.NewDecoder()
17+
)

net/http/headers.go

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package httpext
2+
3+
// HTTP Header keys
4+
const (
5+
Age string = "Age"
6+
AltSCV string = "Alt-Svc"
7+
Accept string = "Accept"
8+
AcceptCharset string = "Accept-Charset"
9+
AcceptPatch string = "Accept-Patch"
10+
AcceptRanges string = "Accept-Ranges"
11+
AcceptedLanguage string = "Accept-Language"
12+
AcceptEncoding string = "Accept-Encoding"
13+
Authorization string = "Authorization"
14+
CrossOriginResourcePolicy string = "Cross-Origin-Resource-Policy"
15+
CacheControl string = "Cache-Control"
16+
Connection string = "Connection"
17+
ContentDisposition string = "Content-Disposition"
18+
ContentEncoding string = "Content-Encoding"
19+
ContentLength string = "Content-Length"
20+
ContentType string = "Content-Type"
21+
ContentLanguage string = "Content-Language"
22+
ContentLocation string = "Content-Location"
23+
ContentRange string = "Content-Range"
24+
Date string = "Date"
25+
DeltaBase string = "Delta-Base"
26+
ETag string = "ETag"
27+
Expires string = "Expires"
28+
Host string = "Host"
29+
IM string = "IM"
30+
IfMatch string = "If-Match"
31+
IfModifiedSince string = "If-Modified-Since"
32+
IfNoneMatch string = "If-None-Match"
33+
IfRange string = "If-Range"
34+
IfUnmodifiedSince string = "If-Unmodified-Since"
35+
KeepAlive string = "Keep-Alive"
36+
LastModified string = "Last-Modified"
37+
Link string = "Link"
38+
Pragma string = "Pragma"
39+
ProxyAuthenticate string = "Proxy-Authenticate"
40+
ProxyAuthorization string = "Proxy-Authorization"
41+
PublicKeyPins string = "Public-Key-Pins"
42+
RetryAfter string = "Retry-After"
43+
Referer string = "Referer"
44+
Server string = "Server"
45+
SetCookie string = "Set-Cookie"
46+
StrictTransportSecurity string = "Strict-Transport-Security"
47+
Trailer string = "Trailer"
48+
TK string = "Tk"
49+
TransferEncoding string = "Transfer-Encoding"
50+
Location string = "Location"
51+
Upgrade string = "Upgrade"
52+
Vary string = "Vary"
53+
Via string = "Via"
54+
Warning string = "Warning"
55+
WWWAuthenticate string = "WWW-Authenticate"
56+
XForwardedFor string = "X-Forwarded-For"
57+
XForwardedHost string = "X-Forwarded-Host"
58+
XForwardedProto string = "X-Forwarded-Proto"
59+
XRealIP string = "X-Real-Ip"
60+
XContentTypeOptions string = "X-Content-Type-Options"
61+
XFrameOptions string = "X-Frame-Options"
62+
XXSSProtection string = "X-XSS-Protection"
63+
XDNSPrefetchControl string = "X-DNS-Prefetch-Control"
64+
Allow string = "Allow"
65+
Origin string = "Origin"
66+
AccessControlAllowOrigin string = "Access-Control-Allow-Origin"
67+
AccessControlAllowCredentials string = "Access-Control-Allow-Credentials"
68+
AccessControlAllowHeaders string = "Access-Control-Allow-Headers"
69+
AccessControlAllowMethods string = "Access-Control-Allow-Methods"
70+
AccessControlExposeHeaders string = "Access-Control-Expose-Headers"
71+
AccessControlMaxAge string = "Access-Control-Max-Age"
72+
AccessControlRequestHeaders string = "Access-Control-Request-Headers"
73+
AccessControlRequestMethod string = "Access-Control-Request-Method"
74+
TimingAllowOrigin string = "Timing-Allow-Origin"
75+
UserAgent string = "User-Agent"
76+
)

0 commit comments

Comments
 (0)