mock

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RoundTripper

type RoundTripper struct {
	RoundTripFunc func(req *http.Request) (*http.Response, error)
}

RoundTripper is a custom, mock http.RoundTripper used for testing and mocking purposes ONLY.

func NewMockRoundTripper

func NewMockRoundTripper(roundTripFunc func(req *http.Request) (*http.Response, error)) *RoundTripper

NewMockRoundTripper returns a new RoundTripper which will execut the given roundTripFunc provided by the caller

func (*RoundTripper) RoundTrip

func (m *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip fufills the http.Client interface and executes the provided RoundTripFunc given by the caller in the NewMockRoundTripper

Jump to

Keyboard shortcuts

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