testutil

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertRequest

func AssertRequest(t *testing.T, r *http.Request, method string, expectedHeaders map[string]string, expectedQueryParams map[string]string)

Validates that an HTTP request matches the expected method, headers, and query parameters.

func LoadTestDataFile

func LoadTestDataFile(t *testing.T, filename string) []byte

func NewHTTPTestServer

func NewHTTPTestServer(t *testing.T, routes []HTTPTestRoute) *httptest.Server

func ServeJSONTestDataHandler

func ServeJSONTestDataHandler(t *testing.T, statusCode int, filename string) http.HandlerFunc

Types

type HTTPTestRoute

type HTTPTestRoute struct {
	Method  string
	URL     string // URL pattern (e.g., "/api/v1"). Must not be empty.
	Handler http.HandlerFunc
}

Jump to

Keyboard shortcuts

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