-
Notifications
You must be signed in to change notification settings - Fork 59
/
goz.go
45 lines (36 loc) · 947 Bytes
/
goz.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
package goz
// NewClient new request object
func NewClient(opts ...Options) *Request {
req := &Request{}
opts0 := Options{}
if len(opts) > 0 {
opts0 = opts[0]
}
req.SetOptions(opts0)
return req
}
// Get send get request
func Get(uri string, opts ...Options) (*Response, error) {
r := NewClient()
return r.Request("GET", uri, opts...)
}
// Post send post request
func Post(uri string, opts ...Options) (*Response, error) {
r := NewClient()
return r.Request("POST", uri, opts...)
}
// Put send put request
func Put(uri string, opts ...Options) (*Response, error) {
r := NewClient()
return r.Request("PUT", uri, opts...)
}
// Patch send patch request
func Patch(uri string, opts ...Options) (*Response, error) {
r := NewClient()
return r.Request("PATCH", uri, opts...)
}
// Delete send delete request
func Delete(uri string, opts ...Options) (*Response, error) {
r := NewClient()
return r.Request("DELETE", uri, opts...)
}