mock

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

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

func LoadCallsFromFile added in v0.4.6

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

type Error added in v0.6.0

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

func (*Error) Error added in v0.6.0

func (e *Error) Error() string

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 RawCall added in v0.4.6

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

type RawError added in v0.4.9

type RawError struct {
	StatusCode int `json:"status_code"`
}

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