httptesting

package
v1.61.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

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