httptesting

package
v1.51.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: AGPL-3.0 Imports: 7 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

func BuildResponse

func BuildResponse(code int, payload []byte) *http.Response

func BuildResponseJson

func BuildResponseJson(code int, payload interface{}) *http.Response

func BuildResponseString

func BuildResponseString(code int, payload string) *http.Response

func DeleteHeader

func DeleteHeader(resp *http.Response, name string) *http.Response

func HttpClientFromFile

func HttpClientFromFile(filename string) *http.Client

func HttpClientSaver

func HttpClientSaver(saved **http.Request, content string) *http.Client

"Saver" refers to saving the *http.Request in a local variable provided by the caller.

func HttpClientSaverWithJson

func HttpClientSaverWithJson(saved **http.Request, jsonData interface{}) *http.Client

func HttpClientWithContent

func HttpClientWithContent(content string) *http.Client

func HttpClientWithError

func HttpClientWithError(err error) *http.Client

func HttpClientWithJson

func HttpClientWithJson(jsonData interface{}) *http.Client

func MockWithJsonReply

func MockWithJsonReply(url string, rawData interface{}) *http.Client

func SetHeader

func SetHeader(resp *http.Response, name string, value string) *http.Response

Types

type EchoSave

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

func (*EchoSave) RoundTrip

func (st *EchoSave) RoundTrip(req *http.Request) (*http.Response, error)

type MockTransport

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

func (*MockTransport) DELETE

func (transport *MockTransport) DELETE(path string, f RoundTripFunc)

func (*MockTransport) GET

func (transport *MockTransport) GET(path string, f RoundTripFunc)

func (*MockTransport) POST

func (transport *MockTransport) POST(path string, f RoundTripFunc)

func (*MockTransport) PUT

func (transport *MockTransport) PUT(path string, f RoundTripFunc)

func (*MockTransport) PostOrDelete

func (transport *MockTransport) PostOrDelete(isDelete bool, path string, f RoundTripFunc)

Used for migration to MAX v3 api, where order cancel uses DELETE (MAX v2 api uses POST).

func (*MockTransport) RoundTrip

func (transport *MockTransport) RoundTrip(req *http.Request) (*http.Response, error)

type RoundTripFunc

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

Jump to

Keyboard shortcuts

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