urltest

package
v1.4.6-0...-50c1585 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Test_URL

func Test_URL(t *testing.T, handler http.HandlerFunc, u URLTest)

Fakes a HTTP request with all headers etc properly set for easy one-shot testing

Types

type ClosableRecorder

type ClosableRecorder struct {
	*httptest.ResponseRecorder
	// contains filtered or unexported fields
}

func NewClosableRecorder

func NewClosableRecorder() *ClosableRecorder

func (*ClosableRecorder) CloseNotify

func (r *ClosableRecorder) CloseNotify() <-chan bool

type URLTest

type URLTest struct {
	Desc     string      /* Description of the test (primarily for grepping to be able to find it) */
	Method   string      /* Request Method: GET, POST, HEAD, PUT, etc */
	Path     string      /* Request Path: The path of the request */
	Username string      /* Request Username: as who should the request run? */
	Header   http.Header /* Request Headers */
	BodyVals url.Values  /* Request Body Values Body of the request (or nil) */
	RC       int         /* Response: Expected HTTP return code (or 0 to ignore this check) */
	Positive []string    /* Response: Expected Regexps that must     be present in the body */
	Negative []string    /* Response: Expected Regexps that must NOT be present in the body */
}

func URLTest_404

func URLTest_404(path string) URLTest

Jump to

Keyboard shortcuts

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