github.com/gospider007/requests@v0.0.0-20240506025355-c73d46169a23/test/response/rawConn_test.go (about) 1 package main 2 3 import ( 4 "testing" 5 6 "github.com/gospider007/requests" 7 ) 8 9 func TestRawConn(t *testing.T) { 10 resp, err := requests.Get(nil, "https://httpbin.org/anything") 11 if err != nil { 12 t.Error(err) 13 } 14 if resp.Conn() != nil { 15 t.Error("conn is not nil") 16 } 17 resp, err = requests.Get(nil, "https://httpbin.org/anything", requests.RequestOption{Stream: true}) 18 if err != nil { 19 t.Error(err) 20 } 21 if resp.Conn() == nil { 22 t.Error("conn is nil") 23 } 24 }