mock

package
v0.0.0-...-c113622 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataFunc

type DataFunc func(Request, Response) error

DataFunc is the function to resolve the mapping of request and response data

type Func

type Func func(*http.HttpRequest, *http.HttpResponse) error

Func is the handler to process http request and return a http response or error

type HttpClient

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

HttpClient is the mocked client of ucloud api

func NewHttpClient

func NewHttpClient() *HttpClient

NewHttpClient will return a new mocked client instance

func (*HttpClient) MockData

func (c *HttpClient) MockData(fn DataFunc) error

MockData will append the data mocking function to the mocked client

func (*HttpClient) MockHTTP

func (c *HttpClient) MockHTTP(fn Func) error

MockHTTP will append the mocking function to the mocked client

func (*HttpClient) Send

func (c *HttpClient) Send(req *http.HttpRequest) (*http.HttpResponse, error)

Send is the mocked method to handle the request and response data

type Request

type Request map[string]interface{}

Request is the parameters of an action invoking

type Response

type Response map[string]interface{}

Response is the response data of an action invoking

Jump to

Keyboard shortcuts

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