mock

package
v2.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...Option) µ.Config

Mock HTTP Client

Types

type Mock

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

Mocks HTTP client

func (*Mock) Do

func (mock *Mock) Do(req *http.Request) (*http.Response, error)

type Option

type Option func(m *Mock)

Mocks Option

func Body

func Body(body []byte) Option

Mock response body (default empty)

func Fail

func Fail(err error) Option

Mock failure of HTTP client

func Header(h, v string) Option

Mock response with HTTP header (default none)

func IOError

func IOError(err error) Option

Mock response body I/O error (default nil)

func Preset

func Preset(opts ...Option) Option

func Status

func Status(code int) Option

Mock response with status code (default 200)

Jump to

Keyboard shortcuts

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