go/src/net/http/clientserver_test.go

type testMode

const http1Mode

const https1Mode

const http2Mode

type testNotParallelOpt

var testNotParallel

type TBRun

// run runs a client/server test in a variety of test configurations.
//
// Tests execute in HTTP/1.1 and HTTP/2 modes by default.
// To run in a different set of configurations, pass a []testMode option.
//
// Tests call t.Parallel() by default.
// To disable parallel execution, pass the testNotParallel option.
func run[T TBRun[T]](t T, f func(t T, mode testMode), opts ...any) {}

type clientServerTest

func (t *clientServerTest) close() {}

func (t *clientServerTest) getURL(u string) string {}

func (t *clientServerTest) scheme() string {}

var optQuietLog

func optWithServerLog(lg *log.Logger) func(*httptest.Server) {}

// newClientServerTest creates and starts an httptest.Server.
//
// The mode parameter selects the implementation to test:
// HTTP/1, HTTP/2, etc. Tests using newClientServerTest should use
// the 'run' function, which will start a subtests for each tested mode.
//
// The vararg opts parameter can include functions to configure the
// test server or transport.
//
//	func(*httptest.Server) // run before starting the server
//	func(*http.Transport)
func newClientServerTest(t testing.TB, mode testMode, h Handler, opts ...any) *clientServerTest {}

type testLogWriter

func (w testLogWriter) Write(b []byte) (int, error) {}

// Testing the newClientServerTest helper itself.
func TestNewClientServerTest(t *testing.T) {}

func testNewClientServerTest(t *testing.T, mode testMode) {}

func TestChunkedResponseHeaders(t *testing.T) {}

func testChunkedResponseHeaders(t *testing.T, mode testMode) {}

type reqFunc

type h12Compare

func (tt h12Compare) reqFunc() reqFunc {}

func (tt h12Compare) run(t *testing.T) {}

func mostlyCopy(r *Response) *Response {}

type slurpResult

func (sr slurpResult) String() string {}

func (tt h12Compare) normalizeRes(t *testing.T, res *Response, wantProto string) {}

// Issue 13532
func TestH12_HeadContentLengthNoBody(t *testing.T) {}

func TestH12_HeadContentLengthSmallBody(t *testing.T) {}

func TestH12_HeadContentLengthLargeBody(t *testing.T) {}

func TestH12_200NoBody(t *testing.T) {}

func TestH2_204NoBody(t *testing.T) {}

func TestH2_304NoBody(t *testing.T) {}

func TestH2_404NoBody(t *testing.T) {}

func testH12_noBody(t *testing.T, status int) {}

func TestH12_SmallBody(t *testing.T) {}

func TestH12_ExplicitContentLength(t *testing.T) {}

func TestH12_FlushBeforeBody(t *testing.T) {}

func TestH12_FlushMidBody(t *testing.T) {}

func TestH12_Head_ExplicitLen(t *testing.T) {}

func TestH12_Head_ImplicitLen(t *testing.T) {}

func TestH12_HandlerWritesTooLittle(t *testing.T) {}

// Tests that the HTTP/1 and HTTP/2 servers prevent handlers from
// writing more than they declared. This test does not test whether
// the transport deals with too much data, though, since the server
// doesn't make it possible to send bogus data. For those tests, see
// transport_test.go (for HTTP/1) or x/net/http2/transport_test.go
// (for HTTP/2).
func TestHandlerWritesTooMuch(t *testing.T) {}

func testHandlerWritesTooMuch(t *testing.T, mode testMode) {}

// Verify that both our HTTP/1 and HTTP/2 request and auto-decompress gzip.
// Some hosts send gzip even if you don't ask for it; see golang.org/issue/13298
func TestH12_AutoGzip(t *testing.T) {}

func TestH12_AutoGzip_Disabled(t *testing.T) {}

// Test304Responses verifies that 304s don't declare that they're
// chunking in their response headers and aren't allowed to produce
// output.
func Test304Responses(t *testing.T) {}

func test304Responses(t *testing.T, mode testMode) {}

func TestH12_ServerEmptyContentLength(t *testing.T) {}

func TestH12_RequestContentLength_Known_NonZero(t *testing.T) {}

func TestH12_RequestContentLength_Known_Zero(t *testing.T) {}

func TestH12_RequestContentLength_Unknown(t *testing.T) {}

func h12requestContentLength(t *testing.T, bodyfn func() io.Reader, wantLen int64) {}

// Tests that closing the Request.Cancel channel also while still
// reading the response body. Issue 13159.
func TestCancelRequestMidBody(t *testing.T) {}

func testCancelRequestMidBody(t *testing.T, mode testMode) {}

// Tests that clients can send trailers to a server and that the server can read them.
func TestTrailersClientToServer(t *testing.T) {}

func testTrailersClientToServer(t *testing.T, mode testMode) {}

// Tests that servers send trailers to a client and that the client can read them.
func TestTrailersServerToClient(t *testing.T) {}

func TestTrailersServerToClientFlush(t *testing.T) {}

func testTrailersServerToClient(t *testing.T, mode testMode, flush bool) {}

// Don't allow a Body.Read after Body.Close. Issue 13648.
func TestResponseBodyReadAfterClose(t *testing.T) {}

func testResponseBodyReadAfterClose(t *testing.T, mode testMode) {}

func TestConcurrentReadWriteReqBody(t *testing.T) {}

func testConcurrentReadWriteReqBody(t *testing.T, mode testMode) {}

func TestConnectRequest(t *testing.T) {}

func testConnectRequest(t *testing.T, mode testMode) {}

func TestTransportUserAgent(t *testing.T) {}

func testTransportUserAgent(t *testing.T, mode testMode) {}

func TestStarRequestMethod(t *testing.T) {}

func testStarRequest(t *testing.T, method string, mode testMode) {}

// Issue 13957
func TestTransportDiscardsUnneededConns(t *testing.T) {}

func testTransportDiscardsUnneededConns(t *testing.T, mode testMode) {}

// tests that Transport doesn't retain a pointer to the provided request.
func TestTransportGCRequest(t *testing.T) {}

func testTransportGCRequest(t *testing.T, mode testMode, body bool) {}

func TestTransportRejectsInvalidHeaders(t *testing.T) {}

func testTransportRejectsInvalidHeaders(t *testing.T, mode testMode) {}

func TestInterruptWithPanic(t *testing.T) {}

func testInterruptWithPanic(t *testing.T, mode testMode, panicValue any) {}

type lockedBytesBuffer

func (b *lockedBytesBuffer) Write(p []byte) (int, error) {}

// Issue 15366
func TestH12_AutoGzipWithDumpResponse(t *testing.T) {}

// Issue 14607
func TestCloseIdleConnections(t *testing.T) {}

func testCloseIdleConnections(t *testing.T, mode testMode) {}

type noteCloseConn

func (x noteCloseConn) Close() error {}

type testErrorReader

func (r testErrorReader) Read(p []byte) (n int, err error) {}

func TestNoSniffExpectRequestBody(t *testing.T) {}

func testNoSniffExpectRequestBody(t *testing.T, mode testMode) {}

func TestServerUndeclaredTrailers(t *testing.T) {}

func testServerUndeclaredTrailers(t *testing.T, mode testMode) {}

func TestBadResponseAfterReadingBody(t *testing.T) {}

func testBadResponseAfterReadingBody(t *testing.T, mode testMode) {}

func TestWriteHeader0(t *testing.T) {}

func testWriteHeader0(t *testing.T, mode testMode) {}

// Issue 23010: don't be super strict checking WriteHeader's code if
// it's not even valid to call WriteHeader then anyway.
func TestWriteHeaderNoCodeCheck(t *testing.T) {}

func TestWriteHeaderNoCodeCheck_h1hijack(t *testing.T) {}

func testWriteHeaderAfterWrite(t *testing.T, mode testMode, hijack bool) {}

func TestBidiStreamReverseProxy(t *testing.T) {}

func testBidiStreamReverseProxy(t *testing.T, mode testMode) {}

// Always use HTTP/1.1 for WebSocket upgrades.
func TestH12_WebSocketUpgrade(t *testing.T) {}

func TestIdentityTransferEncoding(t *testing.T) {}

func testIdentityTransferEncoding(t *testing.T, mode testMode) {}

func TestEarlyHintsRequest(t *testing.T) {}

func testEarlyHintsRequest(t *testing.T, mode testMode) {}