github.com/gospider007/requests@v0.0.0-20240506025355-c73d46169a23/test/protocol/http1_test.go (about)

     1  package main
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/gospider007/requests"
     7  )
     8  
     9  func TestHttp1(t *testing.T) {
    10  	resp, err := requests.Get(nil, "https://httpbin.org/anything", requests.RequestOption{
    11  		ForceHttp1: true,
    12  		DisAlive:   true,
    13  	})
    14  	if err != nil {
    15  		t.Error(err)
    16  	}
    17  	if resp.StatusCode() != 200 {
    18  		t.Error("resp.StatusCode!= 200")
    19  	}
    20  	if resp.Proto() != "HTTP/1.1" {
    21  		t.Error("resp.Proto!= HTTP/1.1")
    22  	}
    23  }