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

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