package cookie

import "github.com/google/martian/v3/cookie"

Package cookie allows for the modification of cookies on http requests and responses.

Index

Functions

func NewFilter

func NewFilter(cookie *http.Cookie) *filter.Filter

NewFilter builds a new cookie filter.

func NewModifier

func NewModifier(cookie *http.Cookie) martian.RequestResponseModifier

NewModifier returns a modifier that injects the provided cookie into the request or response.

Types

type Matcher

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

Matcher is a conditonal evalutor of request or response cookies to be used in structs that take conditions.

func NewMatcher

func NewMatcher(cookie *http.Cookie) *Matcher

NewMatcher builds a cookie matcher.

func (*Matcher) MatchRequest

func (m *Matcher) MatchRequest(req *http.Request) bool

MatchRequest evaluates a request and returns whether or not the request contains a cookie that matches the provided name, path and value.

func (*Matcher) MatchResponse

func (m *Matcher) MatchResponse(res *http.Response) bool

MatchResponse evaluates a response and returns whether or not the response contains a cookie that matches the provided name and value.

Source Files

cookie_filter.go cookie_matcher.go cookie_modifier.go

Version
v3.3.3 (latest)
Published
Aug 16, 2022
Platform
linux/amd64
Imports
7 packages
Last checked
6 hours ago

Tools for package owners.