forked from monaco-io/request
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.go
More file actions
48 lines (41 loc) · 1.38 KB
/
model.go
File metadata and controls
48 lines (41 loc) · 1.38 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
package request
import "time"
const (
// ApplicationJSON application/json
ApplicationJSON ContentType = "application/json"
// ApplicationXWwwFormURLEncoded application/x-www-form-urlencoded
ApplicationXWwwFormURLEncoded ContentType = "application/x-www-form-urlencoded"
// MultipartFormData multipart/form-data
MultipartFormData ContentType = "multipart/form-data"
)
// ContentType Content-Type
type ContentType string
// Client Method
/*
Method = "OPTIONS" ; Section 9.2
| "GET" ; Section 9.3
| "HEAD" ; Section 9.4
| "POST" ; Section 9.5
| "PUT" ; Section 9.6
| "DELETE" ; Section 9.7
| "TRACE" ; Section 9.8
| "CONNECT" ; Section 9.9
| extension-method
extension-method = token
token = 1*<any CHAR except CTLs or separators>
*/
type Client struct {
URL string
Method string
Header map[string]string
Params map[string]string
Body []byte
BasicAuth BasicAuth
Timeout time.Duration // second
ContentType ContentType
}
// BasicAuth Add Username:Password as Basic Auth
type BasicAuth struct {
Username string
Password string
}