-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinet.go
More file actions
50 lines (41 loc) · 1.12 KB
/
Copy pathinet.go
File metadata and controls
50 lines (41 loc) · 1.12 KB
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
package inet
import (
"io"
"net/http"
"net/url"
)
// Get will make a GET request using the DefaultClient.
func Get(uri string) (res *http.Response, e error) {
if res, e = DefaultClient.Get(uri); e != nil {
return nil, e //nolint:wrapcheck // Intentionally not wrapping
}
return res, nil
}
// Head will make a HEAD request using the DefaultClient.
func Head(uri string) (res *http.Response, e error) {
if res, e = DefaultClient.Head(uri); e != nil {
return nil, e //nolint:wrapcheck // Intentionally not wrapping
}
return res, nil
}
// Post will make a POST request using the DefaultClient.
func Post(
uri string,
contentType string,
body io.Reader,
) (res *http.Response, e error) {
if res, e = DefaultClient.Post(uri, contentType, body); e != nil {
return nil, e //nolint:wrapcheck // Intentionally not wrapping
}
return res, nil
}
// PostForm will make a POST request using the DefaultClient.
func PostForm(
uri string,
form url.Values,
) (res *http.Response, e error) {
if res, e = DefaultClient.PostForm(uri, form); e != nil {
return nil, e //nolint:wrapcheck // Intentionally not wrapping
}
return res, nil
}