github.com/Uhtred009/v2ray-core-1@v4.31.2+incompatible/proxy/blackhole/config_test.go (about) 1 package blackhole_test 2 3 import ( 4 "bufio" 5 "net/http" 6 "testing" 7 8 "v2ray.com/core/common" 9 "v2ray.com/core/common/buf" 10 . "v2ray.com/core/proxy/blackhole" 11 ) 12 13 func TestHTTPResponse(t *testing.T) { 14 buffer := buf.New() 15 16 httpResponse := new(HTTPResponse) 17 httpResponse.WriteTo(buf.NewWriter(buffer)) 18 19 reader := bufio.NewReader(buffer) 20 response, err := http.ReadResponse(reader, nil) 21 common.Must(err) 22 if response.StatusCode != 403 { 23 t.Error("expected status code 403, but got ", response.StatusCode) 24 } 25 }