mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-11 04:54:42 +08:00
http模块
This commit is contained in:
29
sysmodule/HttpClientPoolModule_test.go
Normal file
29
sysmodule/HttpClientPoolModule_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package sysmodule_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/duanhf2012/origin/sysmodule"
|
||||
)
|
||||
|
||||
func TestHttpClientPoolModule(t *testing.T) {
|
||||
c := sysmodule.HttpClientPoolModule{}
|
||||
c.Init(10)
|
||||
|
||||
rsp := c.Request(http.MethodGet, "https://www.baidu.com/", 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)
|
||||
rsp1 := srsp.Get(1)
|
||||
fmt.Println(rsp1.Err)
|
||||
fmt.Println(rsp1.Header)
|
||||
fmt.Println(rsp1.StatusCode)
|
||||
fmt.Println(rsp1.Status)
|
||||
fmt.Println(string(rsp1.Body))
|
||||
}
|
||||
Reference in New Issue
Block a user