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

mock

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c []Call) api.Requestor

Types

type Call

type Call struct {
	Verb     string
	Endpoint string
	Data     any
	Error    error
	Response *http.Response
}

func LoadCallsFromFile added in v0.4.6

func LoadCallsFromFile(path string) ([]Call, error)

type Mock

type Mock struct {
	Calls []Call
	// contains filtered or unexported fields
}

func (*Mock) Done added in v0.4.6

func (m *Mock) Done() error

func (*Mock) Request

func (m *Mock) Request(verb, endpoint string, _ io.Reader) (*http.Response, error)

type MockError

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

func (*MockError) Error

func (e *MockError) Error() string

type RawCall added in v0.4.6

type RawCall struct {
	Verb     string      `json:"verb"`
	Endpoint string      `json:"endpoint"`
	Data     any         `json:"data"`
	Error    error       `json:"error"`
	Response RawResponse `json:"response"`
}

type RawResponse added in v0.4.6

type RawResponse struct {
	Headers    map[string][]string `json:"headers"`
	StatusCode int                 `json:"status_code"`
	Body       any                 `json:"body"`
}

Jump to

Keyboard shortcuts

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