Documentation ¶
Overview ¶
Package filter provides a modifier that executes a given set of child modifiers based on the evaluated value of the provided conditional.
Index ¶
- type Filter
- func (f *Filter) ModifyRequest(req *http.Request) error
- func (f *Filter) ModifyResponse(res *http.Response) error
- func (f *Filter) RequestWhenFalse(mod martian.RequestModifier)
- func (f *Filter) RequestWhenTrue(mod martian.RequestModifier)
- func (f *Filter) ResetRequestVerifications()
- func (f *Filter) ResetResponseVerifications()
- func (f *Filter) ResponseWhenFalse(mod martian.ResponseModifier)
- func (f *Filter) ResponseWhenTrue(mod martian.ResponseModifier)
- func (f *Filter) SetRequestCondition(reqcond RequestCondition)
- func (f *Filter) SetRequestModifier(reqmod martian.RequestModifier)
- func (f *Filter) SetResponseCondition(rescond ResponseCondition)
- func (f *Filter) SetResponseModifier(resmod martian.ResponseModifier)
- func (f *Filter) VerifyRequests() error
- func (f *Filter) VerifyResponses() error
- type RequestCondition
- type ResponseCondition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is a modifer that contains conditions to evaluate on request and response as well as a set of modifiers to execute based on the value of the provided RequestCondition or ResponseCondition.
func New ¶
func New() *Filter
New returns a pointer to a Filter with all child modifiers initialized to the noop modifier.
func (*Filter) ModifyRequest ¶
ModifyRequest evaluates reqcond and executes treqmod iff reqcond evaluates to true; otherwise, freqmod is executed.
func (*Filter) ModifyResponse ¶
ModifyResponse evaluates rescond and executes tresmod iff rescond evaluates to true; otherwise, fresmod is executed.
func (*Filter) RequestWhenFalse ¶
func (f *Filter) RequestWhenFalse(mod martian.RequestModifier)
RequestWhenFalse sets the martian.RequestModifier that is executed when the RequestCondition evaluates to False.
func (*Filter) RequestWhenTrue ¶
func (f *Filter) RequestWhenTrue(mod martian.RequestModifier)
RequestWhenTrue sets the martian.RequestModifier that is executed when the RequestCondition evaluates to True.
func (*Filter) ResetRequestVerifications ¶
func (f *Filter) ResetRequestVerifications()
ResetRequestVerifications resets the state of the contained request verifiers.
func (*Filter) ResetResponseVerifications ¶
func (f *Filter) ResetResponseVerifications()
ResetResponseVerifications resets the state of the contained request verifiers.
func (*Filter) ResponseWhenFalse ¶
func (f *Filter) ResponseWhenFalse(mod martian.ResponseModifier)
ResponseWhenFalse sets the martian.ResponseModifier that is executed when the ResponseCondition evaluates to False.
func (*Filter) ResponseWhenTrue ¶
func (f *Filter) ResponseWhenTrue(mod martian.ResponseModifier)
ResponseWhenTrue sets the martian.ResponseModifier that is executed when the ResponseCondition evaluates to True.
func (*Filter) SetRequestCondition ¶
func (f *Filter) SetRequestCondition(reqcond RequestCondition)
SetRequestCondition sets the condition to evaluate on requests.
func (*Filter) SetRequestModifier ¶
func (f *Filter) SetRequestModifier(reqmod martian.RequestModifier)
SetRequestModifier sets the martian.RequestModifier that is executed when the RequestCondition evaluates to True. This function is provided to maintain backwards compatability with filtering prior to filter.Filter.
func (*Filter) SetResponseCondition ¶
func (f *Filter) SetResponseCondition(rescond ResponseCondition)
SetResponseCondition sets the condition to evaluate on responses.
func (*Filter) SetResponseModifier ¶
func (f *Filter) SetResponseModifier(resmod martian.ResponseModifier)
SetResponseModifier sets the martian.ResponseModifier that is executed when the ResponseCondition evaluates to True. This function is provided to maintain backwards compatability with filtering prior to filter.Filter.
func (*Filter) VerifyRequests ¶
VerifyRequests returns an error containing all the verification errors returned by request verifiers.
func (*Filter) VerifyResponses ¶
VerifyResponses returns an error containing all the verification errors returned by response verifiers.
type RequestCondition ¶
RequestCondition is the interface that describes matchers for response filters
type ResponseCondition ¶
ResponseCondition is the interface that describes matchers for response filters