github.com/fumiama/terasu@v0.0.0-20240507144117-547a591149c0/http2/http2_test.go (about) 1 package http2 2 3 import ( 4 "io" 5 "testing" 6 ) 7 8 func TestClientGet(t *testing.T) { 9 resp, err := Get("https://huggingface.co/") 10 if err != nil { 11 t.Fatal(err) 12 } 13 defer resp.Body.Close() 14 t.Log("[T] response code", resp.StatusCode) 15 for k, vs := range resp.Header { 16 for _, v := range vs { 17 t.Log("[T] response header", k+":", v) 18 } 19 } 20 data, err := io.ReadAll(resp.Body) 21 if err != nil { 22 t.Fatal(err) 23 } 24 if len(data) == 0 { 25 t.Fail() 26 } 27 t.Log(string(data)) 28 }