package requests import ( "net/http" "testing" "474420502.top/eson/gjson" ) func TestTest(t *testing.T) { var gresp *http.Response var err error gresp, err = http.DefaultClient.Get("http://httpbin.org/get") if err != nil { t.Error(err) } resp, err := FromHTTPResponse(gresp) if err != nil { t.Error(err) } if gjson.Get(resp.Content(), "headers.Host").String() != "httpbin.org" { t.Error("headers.Host != httpbin.org ?") } if resp.GetSrcResponse().StatusCode != 200 { t.Error("StatusCode != 200") } if len(resp.GetSrcResponse().Header) == 0 { t.Error("esp.GetSrcResponse().Header == nil") } }