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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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