request

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(ctx context.Context, req *transport.Request) (*transport.Request, error)

Validate is a shortcut for the case where a request needs to be validated without changing the TTL.

Types

type Validator

type Validator struct {
	Request *transport.Request
	// contains filtered or unexported fields
}

Validator helps validate requests.

v := Validator{Request: request}
v.ParseTTL(ttlstring)
request, err := v.Validate()

func (*Validator) ParseTTL

func (v *Validator) ParseTTL(ctx context.Context, ttl string) (context.Context, func())

ParseTTL takes a context parses the given TTL, clamping the context to that TTL and as a side-effect, tracking any errors encountered while attempting to parse and validate that TTL.

func (*Validator) Validate

func (v *Validator) Validate(ctx context.Context) (*transport.Request, error)

Validate checks that the request inside this validator is valid and returns either the validated request or an error.

type ValidatorOutbound

type ValidatorOutbound struct{ transport.Outbound }

ValidatorOutbound wraps an Outbound to validate all outgoing requests.

func (ValidatorOutbound) Call

Call performs the given request, failing early if the request is invalid.

Jump to

Keyboard shortcuts

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