test

package
v0.0.0-...-e00d9b6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIRequest

type APIRequest struct {
	Method           string
	Path             string
	RequestJSON      any // if non-nil, will be encoded as JSON
	ExpectStatusCode int
	ExpectBody       *string // raw content (not a file path)
	ExpectJSON       string  // path to JSON file
	ExpectFile       string  // path to arbitrary file
}

APIRequest contains all metadata about a test request.

func (APIRequest) Check

func (r APIRequest) Check(t *testing.T, handler http.Handler)

Check performs the HTTP request described by this APIRequest against the given http.Handler and compares the response with the expectation in the APIRequest.

Jump to

Keyboard shortcuts

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