assert

package
v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func func(*http.Response, *http.Request) error

Func represents the required interface for assertion functions.

func BodyEquals

func BodyEquals(value string) Func

BodyEquals asserts as strict equality comparison the response body with a given string string.

func BodyLength

func BodyLength(length int) Func

BodyLength asserts a response body length.

func BodyMatchString

func BodyMatchString(pattern string) Func

BodyMatchString asserts a response body matching a string expression. Regular expressions can be used as value to perform the specific assertions.

func Header(key, value string) Func

Header asserts a response header field value matches. Regular expressions can be used as value to perform the specific assertions.

func HeaderEquals

func HeaderEquals(key, value string) Func

HeaderEquals asserts a response header field value is equal to the given value.

func HeaderNotEquals

func HeaderNotEquals(key, value string) Func

HeaderNotEquals asserts a response header field with the given value.

func HeaderNotPresent

func HeaderNotPresent(key string) Func

HeaderNotPresent asserts if a header field is not present in the response.

func HeaderPresent

func HeaderPresent(key string) Func

HeaderPresent asserts if a header field is present in the response.

func JSON

func JSON(data interface{}) Func

JSON deeply and strictly compares the JSON response body with the given JSON structure.

func JSONSchema

func JSONSchema(schema string) Func

JSONSchema validates the response body againts the given JSON schema.

func RedirectTo

func RedirectTo(uri string) Func

RedirectTo asserts the server response redirects to the given URL pattern. Regular expressions are supported.

func StatusClientError

func StatusClientError() Func

StatusClientError asserts the response status code as client error response (>= 400 && < 500).

func StatusEqual

func StatusEqual(code int) Func

StatusEqual asserts the response status code with the given number.

func StatusError

func StatusError() Func

StatusError asserts the response status code as server error response (>= 400 && < 600).

func StatusOk

func StatusOk() Func

StatusOk asserts the response status code as valid response (>= 200 && < 400).

func StatusRange

func StatusRange(start, end int) Func

StatusRange asserts the response status code if it is within the given numeric range.

func StatusRedirect

func StatusRedirect() Func

StatusRedirect asserts the response status code as server redirect status (= 301 || = 302).

func StatusServerError

func StatusServerError() Func

StatusServerError asserts the response status code as server error response (>= 500 && < 600).

func Type

func Type(kind string) Func

Type asserts the response Content-Type header. You can pass an alias as type. Supported alias are: json, html, xml, text, form, urlencoded.

Jump to

Keyboard shortcuts

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