Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotMatched = errors.New("dittomock: request not matched")
Functions ¶
This section is empty.
Types ¶
type DittoBodyPattern ¶
type DittoBodyPattern struct { EqualToJson json.RawMessage `json:"equalToJson,omitempty"` MatchesJsonPath *JSONPathWrapper `json:"matchesJsonPath,omitempty"` }
type DittoMock ¶
type DittoMock struct { Request *DittoRequest Response []*DittoResponse }
type DittoRequest ¶
type DittoRequest struct { Method string BodyPatterns []DittoBodyPattern `json:"bodyPatterns"` }
func (*DittoRequest) String ¶
func (dr *DittoRequest) String() string
type DittoResponse ¶
type DittoResponse struct { Body json.RawMessage Status *RpcStatus }
type JSONPathMessage ¶
type JSONPathWrapper ¶
type JSONPathWrapper struct { JSONPathMessage Partial bool `json:"-"` }
func (*JSONPathWrapper) UnmarshalJSON ¶
func (w *JSONPathWrapper) UnmarshalJSON(data []byte) error
type RequestMatcher ¶
type RequestMatcher struct {
// contains filtered or unexported fields
}
func NewRequestMatcher ¶
func NewRequestMatcher(opts ...RequestMatherOption) (*RequestMatcher, error)
func (*RequestMatcher) AddMock ¶
func (rm *RequestMatcher) AddMock(mock DittoMock)
func (*RequestMatcher) Clear ¶
func (rm *RequestMatcher) Clear()
func (*RequestMatcher) Match ¶
func (rm *RequestMatcher) Match(method string, js []byte) (*DittoMock, error)
func (*RequestMatcher) Mocks ¶ added in v0.8.0
func (rm *RequestMatcher) Mocks() map[string][]DittoMock
type RequestMatherOption ¶
type RequestMatherOption func(*RequestMatcher)
func WithLogger ¶
func WithLogger(l logger.Logger) RequestMatherOption
func WithMocks ¶
func WithMocks(mocks []DittoMock) RequestMatherOption
func WithMocksPath ¶
func WithMocksPath(mocksPath string) RequestMatherOption
Click to show internal directories.
Click to hide internal directories.