testutil

package
v2.21.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertBody

func AssertBody(t *testing.T, expected interface{}, req *http.Request)

AssertBody asserts the value of the body of a request.

func SetHeaders

func SetHeaders(w http.ResponseWriter)

SetHeaders sets standard headers for requests

func StripProgress

func StripProgress(input string) string

StripProgress strips the output from the progress method

Types

type TestServer

type TestServer struct {
	Server *httptest.Server
	Mux    *http.ServeMux
}

TestServer represents a test HTTP server along with a path to a config file

func NewTestServer

func NewTestServer() *TestServer

NewTestServer sets up a test HTTP Server without a configuration file.

func NewTestServerAndClient

func NewTestServerAndClient() (string, *TestServer, error)

NewTestServerAndClient sets up a test HTTP Server along with a configuration file to talk to it

func (*TestServer) Close

func (t *TestServer) Close()

Close closes the test HTTP server.

Jump to

Keyboard shortcuts

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