header

package
v0.0.0-...-c724f24 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package header provides utilities for modifying, filtering, and verifying headers in martian.Proxy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBlacklistModifier

func NewBlacklistModifier(names ...string) martian.RequestResponseModifier

NewBlacklistModifier returns a modifier that will delete any header that matches a name contained in the names parameter.

func NewModifier

func NewModifier(name, value string) martian.RequestResponseModifier

NewModifier returns a modifier that will set the header at name with the given value for both requests and responses. If the header name already exists all values will be overwritten.

func NewVerifier

func NewVerifier(name, value string) verify.RequestResponseVerifier

NewVerifier creates a new header verifier for the given name and value.

Types

type Filter

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

Filter filters requests and responses based on header name and value.

func NewFilter

func NewFilter(name, value string) *Filter

NewFilter builds a new header filter.

func (*Filter) ModifyRequest

func (f *Filter) ModifyRequest(ctx *martian.Context, req *http.Request) error

ModifyRequest runs reqmod iff req has a header with name matching value.

func (*Filter) ModifyResponse

func (f *Filter) ModifyResponse(ctx *martian.Context, res *http.Response) error

ModifyResponse runs resmod iff res has a header with name matching value.

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) SetRequestModifier

func (f *Filter) SetRequestModifier(reqmod martian.RequestModifier)

SetRequestModifier sets the request modifier of filter.

func (*Filter) SetResponseModifier

func (f *Filter) SetResponseModifier(resmod martian.ResponseModifier)

SetResponseModifier sets the response modifier of filter.

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.

Jump to

Keyboard shortcuts

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