-
Notifications
You must be signed in to change notification settings - Fork 106
/
Copy pathparams-test.go
42 lines (40 loc) · 833 Bytes
/
params-test.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
package main
import (
"fmt"
"github.com/wangluozhe/requests"
"github.com/wangluozhe/requests/url"
)
func main() {
req := url.NewRequest()
//params := map[string]string{
// "page": "1",
// "limit": "20",
// "skip": "5",
//}
//params := map[string]int{
// "page": 1,
// "limit": 20,
// "skip": 5,
//}
//params := map[string][]string{
// "page": []string{"1", "2"},
// "limit": []string{"20"},
// "skip": []string{"5"},
//}
//params := map[string][]int{
// "page": []int{1, 2},
// "limit": []int{20},
// "skip": []int{5},
//}
params := map[string]interface{}{
"page": []interface{}{"1", 2},
"limit": []string{"20"},
"skip": []int{5},
}
req.Params = url.ParseParams(params)
r, err := requests.Get("https://httpbin.org/get", req)
if err != nil {
fmt.Println(err)
}
fmt.Println(r.Text)
}