Documentation
¶
Index ¶
- type MatchFunc
- type MockTransport
- type RoundTripQueue
- func (q RoundTripQueue) BodyString(body string) RoundTripQueue
- func (q RoundTripQueue) Delete(path string) RoundTripQueue
- func (q RoundTripQueue) Get(path string) RoundTripQueue
- func (q RoundTripQueue) Header(key, value string) RoundTripQueue
- func (q RoundTripQueue) Matcher(matchFunc MatchFunc) RoundTripQueue
- func (q RoundTripQueue) Post(path string) RoundTripQueue
- func (q RoundTripQueue) Put(path string) RoundTripQueue
- func (q RoundTripQueue) Query(key, value string) RoundTripQueue
- func (q RoundTripQueue) Response(res *http.Response) RoundTripQueue
- func (q RoundTripQueue) ResponseFunc(roundTrip func(*http.Request) (*http.Response, error)) RoundTripQueue
- func (q RoundTripQueue) ResponseJSON(statusCode int, body any) RoundTripQueue
- func (q RoundTripQueue) ResponseSimple(statusCode int, body string) RoundTripQueue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockTransport ¶ added in v0.0.4
type MockTransport struct {
// contains filtered or unexported fields
}
Have a RoundTrip queue for each specific request, and if the request matches, retrieve the RoundTrip from the queue and execute it.
func NewTransport ¶
func NewTransport(queues ...RoundTripQueue) *MockTransport
func (*MockTransport) Completed ¶ added in v0.0.4
func (m *MockTransport) Completed() bool
func (*MockTransport) RequestLogString ¶ added in v0.0.5
func (m *MockTransport) RequestLogString() string
type RoundTripQueue ¶
type RoundTripQueue struct {
// contains filtered or unexported fields
}
roundTrip queue
func New ¶
func New(origin string) RoundTripQueue
func (RoundTripQueue) BodyString ¶
func (q RoundTripQueue) BodyString(body string) RoundTripQueue
func (RoundTripQueue) Delete ¶
func (q RoundTripQueue) Delete(path string) RoundTripQueue
func (RoundTripQueue) Get ¶
func (q RoundTripQueue) Get(path string) RoundTripQueue
func (RoundTripQueue) Header ¶
func (q RoundTripQueue) Header(key, value string) RoundTripQueue
func (RoundTripQueue) Matcher ¶ added in v0.0.4
func (q RoundTripQueue) Matcher(matchFunc MatchFunc) RoundTripQueue
func (RoundTripQueue) Post ¶
func (q RoundTripQueue) Post(path string) RoundTripQueue
func (RoundTripQueue) Put ¶
func (q RoundTripQueue) Put(path string) RoundTripQueue
func (RoundTripQueue) Query ¶
func (q RoundTripQueue) Query(key, value string) RoundTripQueue
func (RoundTripQueue) Response ¶
func (q RoundTripQueue) Response(res *http.Response) RoundTripQueue
func (RoundTripQueue) ResponseFunc ¶
func (q RoundTripQueue) ResponseFunc(roundTrip func(*http.Request) (*http.Response, error)) RoundTripQueue
func (RoundTripQueue) ResponseJSON ¶
func (q RoundTripQueue) ResponseJSON(statusCode int, body any) RoundTripQueue
func (RoundTripQueue) ResponseSimple ¶
func (q RoundTripQueue) ResponseSimple(statusCode int, body string) RoundTripQueue
Click to show internal directories.
Click to hide internal directories.