testhelper

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Mux is a multiplexer that can be used to register handlers.
	Mux *http.ServeMux

	// Server is an in-memory HTTP server for testing.
	Server *httptest.Server
)

Functions

func Endpoint

func Endpoint() string

Endpoint returns a fake endpoint that will actually target the Mux.

func SetupHTTP

func SetupHTTP()

SetupHTTP prepares the Mux and Server.

func TeardownHTTP

func TeardownHTTP()

TeardownHTTP releases HTTP-related resources.

func TestBody

func TestBody(t *testing.T, r *http.Request, expected string)

TestBody verifies that the request body matches an expected body.

func TestHeader

func TestHeader(t *testing.T, r *http.Request, header string, expected string)

TestHeader checks that the header on the http.Request matches the expected value.

func TestMethod

func TestMethod(t *testing.T, r *http.Request, expected string)

TestMethod checks that the Request has the expected method (e.g. GET, POST).

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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