http请求添加header和代理

This commit is contained in:
learnmore2019
2019-02-15 10:49:38 +08:00
parent 6945fc8532
commit bc82d200b0
2 changed files with 19 additions and 6 deletions

View File

@@ -12,14 +12,14 @@ func TestHttpClientPoolModule(t *testing.T) {
c := sysmodule.HttpClientPoolModule{}
c.Init(10)
rsp := c.Request(http.MethodGet, "https://www.baidu.com/", nil)
rsp := c.Request(http.MethodGet, "https://www.baidu.com/", nil, nil)
fmt.Println(rsp.Err)
fmt.Println(rsp.Header)
fmt.Println(rsp.StatusCode)
fmt.Println(rsp.Status)
fmt.Println(string(rsp.Body))
srsp := c.SyncRequest(http.MethodGet, "https://www.baidu.com/", nil)
srsp := c.SyncRequest(http.MethodGet, "https://www.baidu.com/", nil, nil)
rsp1 := srsp.Get(1)
fmt.Println(rsp1.Err)
fmt.Println(rsp1.Header)