Documentation ¶
Overview ¶
Package martianurl provides utilities for modifying, filtering, and verifying URLs in martian.Proxy.
Index ¶
- func NewModifier(url *url.URL) martian.RequestModifier
- func NewVerifier(url *url.URL) verify.RequestVerifier
- type Filter
- func (f *Filter) ModifyRequest(req *http.Request) error
- func (f *Filter) ModifyResponse(res *http.Response) error
- func (f *Filter) ResetRequestVerifications()
- func (f *Filter) ResetResponseVerifications()
- func (f *Filter) SetRequestModifier(reqmod martian.RequestModifier)
- func (f *Filter) SetResponseModifier(resmod martian.ResponseModifier)
- func (f *Filter) VerifyRequests() error
- func (f *Filter) VerifyResponses() error
- type Modifier
- type Verifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewModifier ¶
func NewModifier(url *url.URL) martian.RequestModifier
NewModifier overrides the url of the request.
func NewVerifier ¶
func NewVerifier(url *url.URL) verify.RequestVerifier
NewVerifier returns a new URL verifier.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter runs modifiers iff the request URL matches all of the segments in url.
func NewFilter ¶
NewFilter constructs a filter that applies the modifer when the request URL matches all of the provided URL segments.
func (*Filter) ModifyRequest ¶
ModifyRequest runs the modifier if the URL matches all provided matchers.
func (*Filter) ModifyResponse ¶
ModifyResponse runs the modifier if the request URL matches urlMatcher.
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 response verifiers.
func (*Filter) SetRequestModifier ¶
func (f *Filter) SetRequestModifier(reqmod martian.RequestModifier)
SetRequestModifier sets the request modifier.
func (*Filter) SetResponseModifier ¶
func (f *Filter) SetResponseModifier(resmod martian.ResponseModifier)
SetResponseModifier sets the response modifier.
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 Modifier ¶
type Modifier struct {
// contains filtered or unexported fields
}
Modifier alters the request URL fields to match the fields of url.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier verifies the structure of URLs.
func (*Verifier) ModifyRequest ¶
ModifyRequest verifies that the request URL matches all parts of url. If the value in url is non-empty it must be an exact match.
func (*Verifier) ResetRequestVerifications ¶
func (v *Verifier) ResetRequestVerifications()
ResetRequestVerifications clears all failed request verifications.
func (*Verifier) VerifyRequests ¶
VerifyRequests returns an error if verification for any request failed. If an error is returned it will be of type *verify.MultiError.