This commit is contained in:
gospider
2025-01-07 18:04:20 +08:00
parent 4c34d8ba5a
commit 955b0c967c
28 changed files with 410 additions and 310 deletions

View File

@@ -9,9 +9,11 @@ import (
func TestLocalAddr(t *testing.T) {
resp, err := requests.Get(nil, "https://httpbin.org/anything", requests.RequestOption{
DialOption: requests.DialOption{
LocalAddr: &net.TCPAddr{ //set dns server
IP: net.ParseIP("192.168.1.239"),
ClientOption: requests.ClientOption{
DialOption: requests.DialOption{
LocalAddr: &net.TCPAddr{ //set dns server
IP: net.ParseIP("192.168.1.239"),
},
},
},
})

View File

@@ -11,8 +11,10 @@ import (
func TestStream(t *testing.T) {
resp, err := requests.Get(nil, "https://httpbin.org/anything", requests.RequestOption{
Stream: true,
Logger: func(l requests.Log) {
log.Print(l)
ClientOption: requests.ClientOption{
Logger: func(l requests.Log) {
log.Print(l)
},
},
})
if err != nil {