-
Notifications
You must be signed in to change notification settings - Fork 0
/
methods.go
56 lines (45 loc) · 1.06 KB
/
methods.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
package chevron
// Method is an enumeration of HTTP methods.
type Method int
const (
// MethodGet represents the GET HTTP method.
MethodGet Method = iota
// MethodOptions represents the OPTIONS HTTP method.
MethodOptions
// MethodPost represents the POST HTTP method.
MethodPost
// MethodPut represents the PUT HTTP method.
MethodPut
// MethodPatch represents the PATCH HTTP method.
MethodPatch
// MethodDelete represents the DELETE HTTP method.
MethodDelete
)
var allMethods = []Method{
MethodGet,
MethodOptions,
MethodPost,
MethodPut,
MethodPatch,
MethodDelete,
}
var methodMap = map[string]Method{
"GET": MethodGet,
"OPTIONS": MethodOptions,
"POST": MethodPost,
"PUT": MethodPut,
"PATCH": MethodPatch,
"DELETE": MethodDelete,
}
var methodStrings = map[Method]string{
MethodGet: "GET",
MethodOptions: "OPTIONS",
MethodPost: "POST",
MethodPut: "PUT",
MethodPatch: "PATCH",
MethodDelete: "DELETE",
}
// String returns the uppercased HTTP method name.
func (m Method) String() string {
return methodStrings[m]
}