mockGenerator

package
v0.0.0-...-add256a Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	Method consts.HttpMethod `json:"method"`

	Url         string              `json:"url"`
	QueryParams []domain.Param      `json:"queryParams,omitempty"`
	PathParams  []domain.Param      `json:"pathParams,omitempty"`
	Headers     []domain.Param      `json:"headers,omitempty"`
	Cookies     []domain.ExecCookie `json:"cookies,omitempty"`

	Body     string                    `json:"body,omitempty"`
	FormData []domain.BodyFormDataItem `json:"formData,omitempty"`
}

type Response

type Response struct {
	StatusCode consts.HttpRespCode `json:"statusCode"`

	ContentType consts.HttpContentType `json:"contentType"`
	Headers     []domain.Param         `json:"headers,omitempty"`

	Data interface{} `json:"data,omitempty"`

	// used by adv mock
	UseAdvMock bool   `json:"useAdvMock,omitempty"`
	Content    string `json:"content"`
	DelayTime  uint   `json:"delayTime,omitempty"`
}

type ResponseGenerator

type ResponseGenerator interface {
	GenerateResponse(request *http.Request, route *routers.Route, code string) (*Response, error)
}

func New

func New(dataGenerator mockData.MediaGenerator) ResponseGenerator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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