Files
requests/test/session_test.go
赵小小 ee64501285 sync
2024-06-11 22:46:32 +08:00

27 lines
484 B
Go

package main
import (
"testing"
"github.com/gospider007/requests"
)
func TestSession(t *testing.T) {
session, _ := requests.NewClient(nil)
for i := 0; i < 2; i++ {
resp, err := session.Get(nil, "https://httpbin.org/anything")
if err != nil {
t.Error(err)
}
if i == 0 {
if !resp.IsNewConn() { //return is NewConn
t.Error("new conn error: ", i)
}
} else {
if resp.IsNewConn() {
t.Error("new conn error: ", i)
}
}
}
}