httpmock

package
v0.0.0-...-95f6ed8 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchAny

func MatchAny(*http.Request) bool

func RepoNetworkStubForkResponse

func RepoNetworkStubForkResponse(forkFullName, parentFullName string) string

func RepoNetworkStubResponse

func RepoNetworkStubResponse(owner, repo, defaultBranch, permission string) string

Types

type Matcher

type Matcher func(req *http.Request) bool

type Registry

type Registry struct {
	Requests []*http.Request
	// contains filtered or unexported fields
}

func (*Registry) Register

func (r *Registry) Register(m Matcher, resp Responder)

func (*Registry) RoundTrip

func (r *Registry) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip satisfies http.RoundTripper.

func (*Registry) StubForkedRepoResponse

func (r *Registry) StubForkedRepoResponse(ownRepo, parentRepo string)

func (*Registry) StubRepoResponse

func (r *Registry) StubRepoResponse(owner, repo string)

func (*Registry) StubRepoResponseWithDefaultBranch

func (r *Registry) StubRepoResponseWithDefaultBranch(owner, repo, defaultBranch string)

func (*Registry) StubRepoResponseWithPermission

func (r *Registry) StubRepoResponseWithPermission(owner, repo, permission string)

func (*Registry) StubResponse

func (r *Registry) StubResponse(status int, body io.Reader)

func (*Registry) StubWithFixture

func (r *Registry) StubWithFixture(status int, fixtureFileName string) func()

func (*Registry) Verify

func (r *Registry) Verify(t Testing)

type Responder

type Responder func(req *http.Request) (*http.Response, error)

func StringResponse

func StringResponse(body string) Responder

type Stub

type Stub struct {
	Matcher   Matcher
	Responder Responder
	// contains filtered or unexported fields
}

type Testing

type Testing interface {
	Errorf(string, ...interface{})
}

Jump to

Keyboard shortcuts

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