Help us shape the future of Go! Take the 2026 Go Developer Survey

mockhttp

package
v1.37.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasBearerToken

func HasBearerToken(request *http.Request, bearerToken string) bool

Types

type HttpExpression

type HttpExpression struct {
	// contains filtered or unexported fields
}

func (*HttpExpression) Respond

func (e *HttpExpression) Respond(response *http.Response) *MockHttpClient

func (*HttpExpression) RespondFn

func (e *HttpExpression) RespondFn(responseFn RespondFn) *MockHttpClient

func (*HttpExpression) SetNonRetriableError

func (e *HttpExpression) SetNonRetriableError(err error) *MockHttpClient

func (*HttpExpression) SetRetriableError

func (e *HttpExpression) SetRetriableError(err error) *MockHttpClient

type MockHttpClient

type MockHttpClient struct {
	// contains filtered or unexported fields
}

func NewMockHttpUtil

func NewMockHttpUtil() *MockHttpClient

func (*MockHttpClient) CloseIdleConnections

func (c *MockHttpClient) CloseIdleConnections()

func (*MockHttpClient) Do

func (c *MockHttpClient) Do(req *http.Request) (*http.Response, error)

func (*MockHttpClient) Reset

func (c *MockHttpClient) Reset()

func (*MockHttpClient) When

func (c *MockHttpClient) When(predicate RequestPredicate) *HttpExpression

type RequestPredicate

type RequestPredicate func(request *http.Request) bool

type RespondFn

type RespondFn func(request *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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