martianurl

package
v2.0.0-beta.2+incompat... Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package martianurl provides utilities for modifying, filtering, and verifying URLs in martian.Proxy.

Index

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

func NewFilter(u *url.URL) *Filter

NewFilter constructs a filter that applies the modifer when the request URL matches all of the provided URL segments.

func (*Filter) ModifyRequest

func (f *Filter) ModifyRequest(req *http.Request) error

ModifyRequest runs the modifier if the URL matches all provided matchers.

func (*Filter) ModifyResponse

func (f *Filter) ModifyResponse(res *http.Response) error

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

func (f *Filter) VerifyRequests() error

VerifyRequests returns an error containing all the verification errors returned by request verifiers.

func (*Filter) VerifyResponses

func (f *Filter) VerifyResponses() error

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.

func (*Modifier) ModifyRequest

func (m *Modifier) ModifyRequest(req *http.Request) error

ModifyRequest sets the fields of req.URL to m.Url if they are not the zero value.

type Verifier

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

Verifier verifies the structure of URLs.

func (*Verifier) ModifyRequest

func (v *Verifier) ModifyRequest(req *http.Request) error

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

func (v *Verifier) VerifyRequests() error

VerifyRequests returns an error if verification for any request failed. If an error is returned it will be of type *verify.MultiError.

Jump to

Keyboard shortcuts

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