summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/monaco-io/request/doc.go
blob: d225913106f86b87f073e20af298a968aed14bfa (plain) (blame)
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
// Package request HTTP client for golang
//  - Make http requests from Golang
//  - Intercept request and response
//  - Transform request and response data
//
// GET
//
//     client := request.Client{
//         URL:    "https://google.com",
//         Method: "GET",
//         Params: map[string]string{"hello": "world"},
//     }
//     resp, err := client.Do()
//
// POST
//
//     client := request.Client{
//         URL:    "https://google.com",
//         Method: "POST",
//         Params: map[string]string{"hello": "world"},
//         Body:   []byte(`{"hello": "world"}`),
//     }
//     resp, err := client.Do()
//
// Content-Type
//
//     client := request.Client{
//         URL:          "https://google.com",
//         Method:       "POST",
//         ContentType: request.ApplicationXWwwFormURLEncoded, // default is "application/json"
//     }
//     resp, err := client.Do()
//
// Authorization
//
//     client := request.Client{
//         URL:       "https://google.com",
//         Method:    "POST",
//         BasicAuth:      request.BasicAuth{
//             Username:"user_xxx",
//             Password:"pwd_xxx",
//         }, // xxx:xxx
//     }
//
//     resp, err := client.Do()
//
// Cookies
//     client := request.Client{
//         URL:       "https://google.com",
//         Cookies:[]*http.Cookie{
//              {
//               Name:  "cookie_name",
//               Value: "cookie_value",
//              },
//         },
//     }
//
//     resp, err := client.Do()
package request