http

package
v0.0.0-...-3979361 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultVerifier

func NewDefaultVerifier() *defaultVerifier

func ResponseBodyMatches

func ResponseBodyMatches(expectedBody []byte) *responseBodyMatches

ResponseBodyMatches asserts HTTP response body matches.

func ResponseCodeMatches

func ResponseCodeMatches(expectedResponseCode int) *responseCodeMatches

ResponseCodeMatches asserts HTTP response code matches

func ResponseHeaderContains

func ResponseHeaderContains(headerName, expectedValue string) *responseHeaderContains

ResponseHeaderContains asserts HTTP response header contains expected value

Types

type Matcher

type Matcher interface {
	Matches(resp Response) error
}

Matcher tests against specific HTTP behavior.

type Response

type Response struct {
	Body         []byte
	ResponseCode int
	Headers      map[string][]string
}

type URLOptions

type URLOptions struct {
	// TLS options
	InsecureSkipVerify bool

	// Request options
	Method          string
	HostHeader      string
	Headers         map[string]string
	FollowRedirects bool
}

URLOptions contains options for HTTP/HTTPS requests

func DefaultURLOptions

func DefaultURLOptions() URLOptions

DefaultURLOptions provides reasonable defaults for URLOptions

type Verifier

type Verifier interface {
	VerifyURL(url string, matchers ...Matcher) error
	VerifyURLWithOptions(url string, options URLOptions, matchers ...Matcher) error
}

Verifier is responsible for verify the behavior of an HTTP endpoint.

Jump to

Keyboard shortcuts

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