mirror of
https://github.com/gospider007/requests.git
synced 2025-12-24 13:57:52 +08:00
24 lines
489 B
Go
24 lines
489 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/gospider007/gtls"
|
|
"github.com/gospider007/requests"
|
|
)
|
|
|
|
func TestAddType(t *testing.T) {
|
|
session, _ := requests.NewClient(nil, requests.ClientOption{
|
|
DialOption: &requests.DialOption{
|
|
AddrType: gtls.Ipv4,
|
|
},
|
|
})
|
|
resp, err := session.Get(nil, "https://test.ipw.cn")
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
if resp.StatusCode() != 200 {
|
|
t.Errorf("status code error, expected 200, got %d", resp.StatusCode())
|
|
}
|
|
}
|