// NewVerifier creates a new header verifier for the given name and value. func NewVerifier(name, value string) verify.RequestResponseVerifier { return &verifier{ name: name, value: value, reqerr: verify.NewMultiError(), reserr: verify.NewMultiError(), } }
// NewVerifier returns a new method verifier. func NewVerifier(method string) (verify.RequestVerifier, error) { if method == "" { return nil, fmt.Errorf("%s is not a valid HTTP method", method) } return &verifier{ method: method, err: verify.NewMultiError(), }, nil }
// NewVerifier returns a new param verifier. func NewVerifier(key, value string) (verify.RequestVerifier, error) { if key == "" { return nil, fmt.Errorf("no key provided to param verifier") } return &verifier{ key: key, value: value, err: verify.NewMultiError(), }, nil }
// VerifyRequests returns a MultiError containing all the // verification errors returned by request verifiers. func (g *Group) VerifyRequests() error { g.reqmu.Lock() defer g.reqmu.Unlock() merr := verify.NewMultiError() for _, reqmod := range g.reqmods { reqv, ok := reqmod.(verify.RequestVerifier) if !ok { continue } if err := reqv.VerifyRequests(); err != nil { merr.Add(err) } } if merr.Empty() { return nil } return merr }
// NewVerifier returns a new URL verifier. func NewVerifier(url *url.URL) verify.RequestVerifier { return &Verifier{ url: url, err: verify.NewMultiError(), } }
// ResetRequestVerifications clears all failed request verifications. func (v *Verifier) ResetRequestVerifications() { v.err = verify.NewMultiError() }
// ResetResponseVerifications clears all failed response verifications. func (v *verifier) ResetResponseVerifications() { v.reserr = verify.NewMultiError() }
// NewVerifier returns a new status.Verifier for statusCode. func NewVerifier(statusCode int) verify.ResponseVerifier { return &Verifier{ statusCode: statusCode, err: verify.NewMultiError(), } }