httpxtest

package
v0.0.0-...-4e550d2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestServer

func TestServer(t *testing.T, f MakeServer)

TestServer is a test suite for HTTP servers, inspired by golang.org/x/net/nettest.TestConn.

func TestTransport

func TestTransport(t *testing.T, f MakeTransport)

TestTransport is a test suite for HTTP transports, inspired by golang.org/x/net/nettest.TestConn.

Types

type MakeServer

type MakeServer func(ServerConfig) (url string, close func())

MakeServer is a function called by the TestServer test suite to create a new HTTP server that runs the given config. The function must return the URL at which the server can be accessed and a closer function to terminate the server.

type MakeTransport

type MakeTransport func() http.RoundTripper

MakeTransport constructs a new HTTP transport used by a single sub-test of TestTransport.

type ServerConfig

type ServerConfig struct {
	Handler        http.Handler
	ReadTimeout    time.Duration
	WriteTimeout   time.Duration
	MaxHeaderBytes int
}

ServerConfig is used to configure the HTTP server started by MakeServer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL