go/src/net/http/httptest/server.go

type Server

func newLocalListener() net.Listener {}

var serveFlag

func init() {}

func strSliceContainsPrefix(v []string, pre string) bool {}

// NewServer starts and returns a new [Server].
// The caller should call Close when finished, to shut it down.
func NewServer(handler http.Handler) *Server {}

// NewUnstartedServer returns a new [Server] but doesn't start it.
//
// After changing its configuration, the caller should call Start or
// StartTLS.
//
// The caller should call Close when finished, to shut it down.
func NewUnstartedServer(handler http.Handler) *Server {}

// Start starts a server from NewUnstartedServer.
func (s *Server) Start() {}

// StartTLS starts TLS on a server from NewUnstartedServer.
func (s *Server) StartTLS() {}

// NewTLSServer starts and returns a new [Server] using TLS.
// The caller should call Close when finished, to shut it down.
func NewTLSServer(handler http.Handler) *Server {}

type closeIdleTransport

// Close shuts down the server and blocks until all outstanding
// requests on this server have completed.
func (s *Server) Close() {}

func (s *Server) logCloseHangDebugInfo() {}

// CloseClientConnections closes any open HTTP connections to the test Server.
func (s *Server) CloseClientConnections() {}

// Certificate returns the certificate used by the server, or nil if
// the server doesn't use TLS.
func (s *Server) Certificate() *x509.Certificate {}

// Client returns an HTTP client configured for making requests to the server.
// It is configured to trust the server's TLS test certificate and will
// close its idle connections on [Server.Close].
// Use Server.URL as the base URL to send requests to the server.
func (s *Server) Client() *http.Client {}

func (s *Server) goServe() {}

// wrap installs the connection state-tracking hook to know which
// connections are idle.
func (s *Server) wrap() {}

// closeConn closes c.
// s.mu must be held.
func (s *Server) closeConn(c net.Conn) {}

// closeConnChan is like closeConn, but takes an optional channel to receive a value
// when the goroutine closing c is done.
func (s *Server) closeConnChan(c net.Conn, done chan<- struct{}