-
Notifications
You must be signed in to change notification settings - Fork 0
/
methods.go
79 lines (64 loc) · 1.38 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package methods
import (
"strings"
)
// New Function create new implementation of interface
func New() Interface {
return new(impl)
}
// Options Return HTTP method OPTIONS
func (m *impl) Options() Value {
return &methodType{optionsMethod}
}
// Get Return HTTP method GET
func (m *impl) Get() Value {
return &methodType{getMethod}
}
// Head Return HTTP method HEAD
func (m *impl) Head() Value {
return &methodType{headMethod}
}
// Post Return HTTP method POST
func (m *impl) Post() Value {
return &methodType{postMethod}
}
// Put Return HTTP method PUT
func (m *impl) Put() Value {
return &methodType{putMethod}
}
// Patch Return HTTP method PATCH
func (m *impl) Patch() Value {
return &methodType{patchMethod}
}
// Delete Return HTTP method DELETE
func (m *impl) Delete() Value {
return &methodType{deleteMethod}
}
// Trace Return HTTP method TRACE
func (m *impl) Trace() Value {
return &methodType{traceMethod}
}
// Connect Return HTTP method CONNECT
func (m *impl) Connect() Value {
return &methodType{connectMethod}
}
// Parse string and return method interface
func (m *impl) Parse(inp string) Value {
var (
tmp string
key Type
ret *methodType
)
tmp = strings.ToUpper(inp)
for key = range maps {
if maps[key] == tmp {
ret = &methodType{key}
break
}
}
return ret
}
// Parse string and return interface
func Parse(inp string) Value {
return New().Parse(inp)
}