testx

package
v0.0.0-...-b2779c9 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Context

func Context(d deadlined) context.Context

func MockHTTPClient

func MockHTTPClient(rules ...ResponseRule) *http.Client

Types

type ResponseRule

type ResponseRule interface {
	Matches(req *http.Request) bool
	Apply(resp *http.Response)
}

type SimpleUrlRule

type SimpleUrlRule struct {
	StatusCode int
	URL        *url.URL
	Response   []byte
}

func NewSimpleUrlRule

func NewSimpleUrlRule(rawUrl string, response []byte) (SimpleUrlRule, error)

func (SimpleUrlRule) Apply

func (s SimpleUrlRule) Apply(resp *http.Response)

Apply implements ResponseRule.

func (SimpleUrlRule) Matches

func (s SimpleUrlRule) Matches(req *http.Request) bool

Matches implements ResponseRule.

Jump to

Keyboard shortcuts

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