Documentation
¶
Overview ¶
Package hit provides an http integration test framework.
It is designed to be flexible as possible, but to keep a simple to use interface for developers. Example:
package main
import (
"net/http" . "github.com/Eun/go-hit"
)
func main() {
MustDo(
Description("Post to httpbin.org"),
Get("https://httpbin.org/post"),
Expect().Status().Equal(http.StatusMethodNotAllowed),
Expect().Body().String().Contains("Method Not Allowed"),
)
}
Or use the `Test()` function: package main_test import (
"testing" "net/http" . "github.com/Eun/go-hit"
)
func TestHttpBin(t *testing.T) {
Test(t,
Description("Post to httpbin.org"),
Get("https://httpbin.org/post"),
Expect().Status().Equal(http.StatusMethodNotAllowed),
Expect().Body().String().Contains("Method Not Allowed"),
)
}
Index ¶
- func Do(steps ...IStep) error
- func JoinURL(parts ...string) string
- func MustDo(steps ...IStep)
- func StepCallPath(step IStep, withArguments bool) string
- func Test(t TestingT, steps ...IStep)
- type Callback
- type Error
- type HTTPRequest
- type HTTPResponse
- type Hit
- type IClear
- type IClearExpect
- type IClearExpectBody
- type IClearExpectBodyJSON
- type IClearExpectBodyJSONJQ
- type IClearExpectBytes
- type IClearExpectFloat32
- type IClearExpectFloat64
- type IClearExpectFormValues
- type IClearExpectHeaderValue
- type IClearExpectHeaders
- type IClearExpectInt
- type IClearExpectInt8
- type IClearExpectInt16
- type IClearExpectInt32
- type IClearExpectInt64
- type IClearExpectString
- type IClearExpectUint
- type IClearExpectUint8
- type IClearExpectUint16
- type IClearExpectUint32
- type IClearExpectUint64
- type IClearSend
- type IClearSendBody
- type IClearSendFormValues
- type IClearSendHeaders
- type IDebug
- type IDebugBody
- type IDebugBodyJSON
- type IDebugRequest
- type IDebugResponse
- type IExpect
- type IExpectBody
- type IExpectBodyJSON
- type IExpectBodyJSONJQ
- type IExpectBytes
- type IExpectFloat32
- type IExpectFloat64
- type IExpectFormValues
- type IExpectHeaderValue
- type IExpectHeaders
- type IExpectInt
- type IExpectInt8
- type IExpectInt16
- type IExpectInt32
- type IExpectInt64
- type IExpectString
- type IExpectUint
- type IExpectUint8
- type IExpectUint16
- type IExpectUint32
- type IExpectUint64
- type IRequest
- type IRequestURL
- type IRequestURLQuery
- type IRequestURLUser
- type ISend
- type ISendBody
- type ISendFormValues
- type ISendHeaders
- type IStep
- func BaseURL(url string, a ...interface{}) IStep
- func CombineSteps(steps ...IStep) IStep
- func Connect(url string, a ...interface{}) IStep
- func Context(ctx context.Context) IStep
- func Custom(when StepTime, exec Callback) IStep
- func Delete(url string, a ...interface{}) IStep
- func Description(description string) IStep
- func Get(url string, a ...interface{}) IStep
- func HTTPClient(client *http.Client) IStep
- func Head(url string, a ...interface{}) IStep
- func Method(method, url string, a ...interface{}) IStep
- func Options(url string, a ...interface{}) IStep
- func Post(url string, a ...interface{}) IStep
- func Put(url string, a ...interface{}) IStep
- func Return() IStep
- func Trace(url string, a ...interface{}) IStep
- type IStore
- type IStoreBody
- type IStoreBodyJSON
- type IStoreRequest
- type IStoreResponse
- type IStoreStep
- type IStoreURL
- type IStoreUserInfo
- type StepTime
- type TestingT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JoinURL ¶ added in v0.5.16
JoinURL joins the specified parts to one url.
Example:
JoinURL("https://example.com", "folder", "file") // will return "https://example.com/folder/file"
JoinURL("https://example.com", "index.html") // will return "https://example.com/index.html"
JoinURL("https://", "example.com", "index.html") // will return "https://example.com/index.html"
JoinURL("example.com", "index.html") // will return "example.com/index.html"
MustDo(
Get(JoinURL("https://example.com", "index.html")),
)
func MustDo ¶
func MustDo(steps ...IStep)
MustDo runs the specified steps and panics with the error if something was wrong.
func StepCallPath ¶ added in v0.5.0
StepCallPath returns the representation of the step that is passed in.
Types ¶
type Error ¶ added in v0.5.10
type Error struct {
// contains filtered or unexported fields
}
Error represents the error that will be returned during an execution.
func (*Error) FailingStepIs ¶ added in v0.5.10
FailingStepIs returns true if the specified step is the same as the failing.
Example:
err := Do(
Get("https://example.com"),
Expect().Status().Equal(http.StatusNoContent),
)
var hitError *Error
if errors.As(err, &hitError) {
if hitError.FailingStepIs(Expect().Status().Equal(http.StatusNoContent)) {
fmt.Printf("Expected StatusNoContent")
return
}
}
type HTTPRequest ¶
HTTPRequest contains the http.Request and methods to extract/set data for the body.
func (*HTTPRequest) Body ¶
func (req *HTTPRequest) Body() *httpbody.HTTPBody
Body provides methods for accessing the http body.
type HTTPResponse ¶
HTTPResponse contains the http.Response and methods to extract/set data for the body.
func (*HTTPResponse) Body ¶
func (r *HTTPResponse) Body() *httpbody.HTTPBody
Body provides methods for accessing the http body.
type Hit ¶
type Hit interface {
// Request returns the current request.
Request() *HTTPRequest
// SetRequest sets the request for the current instance.
SetRequest(request *http.Request) error
// Response returns the current Response.
Response() *HTTPResponse
// HTTPClient gets the current http.Client.
HTTPClient() *http.Client
// SetHTTPClient sets the http client for the request.
SetHTTPClient(client *http.Client) error
// BaseURL returns the current base url.
BaseURL() string
// CurrentStep returns the current working step.
CurrentStep() IStep
// Steps returns the current step list.
Steps() []IStep
// AddSteps appends the specified steps to the step list.
AddSteps(steps ...IStep)
// InsertSteps inserts the specified steps right after the current step.
InsertSteps(steps ...IStep)
// RemoveSteps removes the specified steps from the step list.
RemoveSteps(steps ...IStep)
// Do runs the specified steps in in this context.
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Custom(func(hit Hit) error {
// return hit.Do(
// Expect().Status().Equal(http.StatusOK),
// )
// }),
// )
Do(steps ...IStep) error
// MustDo runs the specified steps in in this context and panics on failure.
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Custom(func(hit Hit) error {
// hit.MustDo(
// Expect().Status().Equal(http.StatusOK),
// )
// return nil
// }),
// )
MustDo(steps ...IStep)
// Description gets the current description that will be printed in an error case.
Description() string
// SetDescription sets a custom description for this test.
// The description will be printed in an error case
SetDescription(string)
// Context returns the current request context
Context() context.Context
}
Hit is the interface that will be passed in for Custom() steps.
type IClear ¶
type IClear interface {
// Send removes all previous steps chained to Send()
// e.g. Send().Body().String("Hello World") or Send().Headers("Content-Type", "application/json").
//
// Usage:
// // will remove all previous steps chained to Send() e.g. Send().Body().String("Hello World") or
// // Send().Headers("Content-Type", "application/json")
// Clear().Send()
//
// // will remove all previous steps chained to Send().Body() e.g. Send().Body().String("Hello World") or
// // Send().Body().Int(127)
// Clear().Send().Body()
//
// // will remove all previous Send().Body().String() steps e.g. Send().Body().String("Hello World") or
// // Send().Body().String("Hello Earth")
// Clear().Send().Body().String()
//
// // will remove all previous Send().Body().String("Hello World") steps
// Clear().Send().Body().String("Hello World")
//
// Example:
// MustDo(
// Post("https://example.com"),
// Send().Body().String("Hello Earth"),
// Clear().Send(),
// Send().Body().String("Hello World"),
// )
Send() IClearSend
// Expect removes all previous steps chained to Expect()
// e.g. Expect().Body().String().Equal("Hello World") or Expect().Headers("Content-Type").Equal("application/json").
//
// Usage:
// // will remove all previous steps chained to Expect() e.g. Expect().Body().String().Equal("Hello World")
// // or Expect().Status().Equal(200)
// Clear().Expect()
//
// // will remove all previous steps chained to Expect().Body().String() e.g.
// // Expect().Body().String().Equal("Hello World") or Expect().Body().String().Contains("Hello")
// Clear().Expect().Body().String()
//
// // will remove all previous Expect().Body().String().Equal() steps e.g.
// // Expect().Body().String().Equal("Hello World") or Expect().Body().String().Contains("Hello")
// Clear().Expect().Body().String().Equal()
//
// // will remove all previous Expect().Body().String().Equal("Hello World") steps
// Clear().Expect().Body().String().Equal("Hello World")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Body().String().Equal("Hello Earth"),
// Clear().Expect(),
// Expect().Body().String().Equal("Hello World"),
// )
Expect() IClearExpect
}
IClear provides a clear functionality to remove previous steps from running.
func Clear ¶
func Clear() IClear
Clear can be used to remove previous steps.
Usage:
Clear().Send() // will remove all steps chained to Send()
// e.g Send().Body().String("Hello World")
Clear().Send().Body() // will remove all steps chained to Send().Body()
// e.g Send().Body().String("Hello World")
Clear().Send().Body().String("Hello World") // will remove all Send().Body().String("Hello World")
// steps
Clear().Expect().Body() // will remove all steps chained to Expect().Body()
// e.g. Expect().Body().Equal("Hello World")
Clear().Expect().Body().String().Equal("Hello World") // will remove all
// Expect().Body().String().Equal("Hello World") steps
Example:
MustDo(
Get("https://example.com"),
Expect().Status().Equal(http.StatusNotFound),
Expect().Body().String().Contains("Not found!"),
Clear().Expect(),
Expect().Status().Equal(http.StatusOK),
Expect().Body().String().Contains("Hello World"),
)
type IClearExpect ¶
type IClearExpect interface {
IStep
// Body clears all matching Body steps
Body() IClearExpectBody
// Custom clears all matching Custom steps
Custom(value ...Callback) IStep
// Headers clears all matching Headers steps
Headers(value ...string) IClearExpectHeaders
// Status clears all matching Status steps
Status() IClearExpectInt64
// Trailers clears all matching Trailers steps
Trailers(value ...string) IClearExpectHeaders
}
IClearExpect provides methods to clear steps.
type IClearExpectBody ¶
type IClearExpectBody interface {
IStep
// Bytes clears all matching Bytes steps
Bytes() IClearExpectBytes
// Float32 clears all matching Float32 steps
Float32() IClearExpectFloat32
// Float64 clears all matching Float64 steps
Float64() IClearExpectFloat64
// FormValues clears all matching FormValues steps
FormValues(value ...string) IClearExpectFormValues
// Int clears all matching Int steps
Int() IClearExpectInt
// Int16 clears all matching Int16 steps
Int16() IClearExpectInt16
// Int32 clears all matching Int32 steps
Int32() IClearExpectInt32
// Int64 clears all matching Int64 steps
Int64() IClearExpectInt64
// Int8 clears all matching Int8 steps
Int8() IClearExpectInt8
// JSON clears all matching JSON steps
JSON() IClearExpectBodyJSON
// String clears all matching String steps
String() IClearExpectString
// Uint clears all matching Uint steps
Uint() IClearExpectUint
// Uint16 clears all matching Uint16 steps
Uint16() IClearExpectUint16
// Uint32 clears all matching Uint32 steps
Uint32() IClearExpectUint32
// Uint64 clears all matching Uint64 steps
Uint64() IClearExpectUint64
// Uint8 clears all matching Uint8 steps
Uint8() IClearExpectUint8
}
IClearExpectBody provides methods to clear steps.
type IClearExpectBodyJSON ¶
type IClearExpectBodyJSON interface {
IStep
// Contains clears all matching Contains steps
Contains(value ...interface{}) IStep
// Equal clears all matching Equal steps
Equal(value ...interface{}) IStep
// JQ clears all matching JQ steps
JQ(value ...string) IClearExpectBodyJSONJQ
// Len clears all matching Len steps
Len() IClearExpectInt
// NotContains clears all matching NotContains steps
NotContains(value ...interface{}) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...interface{}) IStep
}
IClearExpectBodyJSON provides methods to clear steps.
type IClearExpectBodyJSONJQ ¶ added in v0.5.0
type IClearExpectBodyJSONJQ interface {
IStep
// Contains clears all matching Contains steps
Contains(value ...interface{}) IStep
// Equal clears all matching Equal steps
Equal(value ...interface{}) IStep
// JQ clears all matching JQ steps
JQ(value ...string) IClearExpectBodyJSONJQ
// Len clears all matching Len steps
Len() IClearExpectInt
// NotContains clears all matching NotContains steps
NotContains(value ...interface{}) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...interface{}) IStep
}
IClearExpectBodyJSONJQ provides methods to clear steps.
type IClearExpectBytes ¶ added in v0.5.0
type IClearExpectBytes interface {
IStep
// Contains clears all matching Contains steps
Contains(value ...[]uint8) IStep
// Equal clears all matching Equal steps
Equal(value ...[]uint8) IStep
// Len clears all matching Len steps
Len() IClearExpectInt
// NotContains clears all matching NotContains steps
NotContains(value ...[]uint8) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...[]uint8) IStep
}
IClearExpectBytes provides methods to clear steps.
type IClearExpectFloat32 ¶ added in v0.5.0
type IClearExpectFloat32 interface {
IStep
// Between clears all matching Between steps
Between(value ...float32) IStep
// Equal clears all matching Equal steps
Equal(value ...float32) IStep
// GreaterOrEqualThan clears all matching GreaterOrEqualThan steps
GreaterOrEqualThan(value ...float32) IStep
// GreaterThan clears all matching GreaterThan steps
GreaterThan(value ...float32) IStep
// LessOrEqualThan clears all matching LessOrEqualThan steps
LessOrEqualThan(value ...float32) IStep
// LessThan clears all matching LessThan steps
LessThan(value ...float32) IStep
// NotBetween clears all matching NotBetween steps
NotBetween(value ...float32) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...float32) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...float32) IStep
// OneOf clears all matching OneOf steps
OneOf(value ...float32) IStep
}
IClearExpectFloat32 provides methods to clear steps.
type IClearExpectFloat64 ¶ added in v0.5.0
type IClearExpectFloat64 interface {
IStep
// Between clears all matching Between steps
Between(value ...float64) IStep
// Equal clears all matching Equal steps
Equal(value ...float64) IStep
// GreaterOrEqualThan clears all matching GreaterOrEqualThan steps
GreaterOrEqualThan(value ...float64) IStep
// GreaterThan clears all matching GreaterThan steps
GreaterThan(value ...float64) IStep
// LessOrEqualThan clears all matching LessOrEqualThan steps
LessOrEqualThan(value ...float64) IStep
// LessThan clears all matching LessThan steps
LessThan(value ...float64) IStep
// NotBetween clears all matching NotBetween steps
NotBetween(value ...float64) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...float64) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...float64) IStep
// OneOf clears all matching OneOf steps
OneOf(value ...float64) IStep
}
IClearExpectFloat64 provides methods to clear steps.
type IClearExpectFormValues ¶ added in v0.5.0
type IClearExpectFormValues interface {
IStep
// Contains clears all matching Contains steps
Contains(value ...interface{}) IStep
// Empty clears all matching Empty steps
Empty() IStep
// Equal clears all matching Equal steps
Equal(value ...interface{}) IStep
// First clears all matching First steps
First() IClearExpectHeaderValue
// Last clears all matching Last steps
Last() IClearExpectHeaderValue
// Len clears all matching Len steps
Len() IClearExpectInt
// NotContains clears all matching NotContains steps
NotContains(value ...interface{}) IStep
// NotEmpty clears all matching NotEmpty steps
NotEmpty() IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...interface{}) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...interface{}) IStep
// Nth clears all matching Nth steps
Nth(value ...int) IClearExpectHeaderValue
// OneOf clears all matching OneOf steps
OneOf(value ...interface{}) IStep
}
IClearExpectFormValues provides methods to clear steps.
type IClearExpectHeaderValue ¶ added in v0.5.21
type IClearExpectHeaderValue interface {
IStep
// Contains clears all matching Contains steps
Contains(value ...interface{}) IStep
// Empty clears all matching Empty steps
Empty() IStep
// Equal clears all matching Equal steps
Equal(value ...interface{}) IStep
// Len clears all matching Len steps
Len() IClearExpectInt
// NotContains clears all matching NotContains steps
NotContains(value ...interface{}) IStep
// NotEmpty clears all matching NotEmpty steps
NotEmpty() IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...interface{}) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...interface{}) IStep
// OneOf clears all matching OneOf steps
OneOf(value ...interface{}) IStep
}
IClearExpectHeaderValue provides methods to clear steps.
type IClearExpectHeaders ¶ added in v0.5.0
type IClearExpectHeaders interface {
IStep
// Contains clears all matching Contains steps
Contains(value ...interface{}) IStep
// Empty clears all matching Empty steps
Empty() IStep
// Equal clears all matching Equal steps
Equal(value ...interface{}) IStep
// First clears all matching First steps
First() IClearExpectHeaderValue
// Last clears all matching Last steps
Last() IClearExpectHeaderValue
// Len clears all matching Len steps
Len() IClearExpectInt
// NotContains clears all matching NotContains steps
NotContains(value ...interface{}) IStep
// NotEmpty clears all matching NotEmpty steps
NotEmpty() IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...interface{}) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...interface{}) IStep
// Nth clears all matching Nth steps
Nth(value ...int) IClearExpectHeaderValue
// OneOf clears all matching OneOf steps
OneOf(value ...interface{}) IStep
}
IClearExpectHeaders provides methods to clear steps.
type IClearExpectInt ¶ added in v0.5.0
type IClearExpectInt interface {
IStep
// Between clears all matching Between steps
Between(value ...int) IStep
// Equal clears all matching Equal steps
Equal(value ...int) IStep
// GreaterOrEqualThan clears all matching GreaterOrEqualThan steps
GreaterOrEqualThan(value ...int) IStep
// GreaterThan clears all matching GreaterThan steps
GreaterThan(value ...int) IStep
// LessOrEqualThan clears all matching LessOrEqualThan steps
LessOrEqualThan(value ...int) IStep
// LessThan clears all matching LessThan steps
LessThan(value ...int) IStep
// NotBetween clears all matching NotBetween steps
NotBetween(value ...int) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...int) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...int) IStep
// OneOf clears all matching OneOf steps
OneOf(value ...int) IStep
}
IClearExpectInt provides methods to clear steps.
type IClearExpectInt8 ¶ added in v0.5.0
type IClearExpectInt8 interface {
IStep
// Between clears all matching Between steps
Between(value ...int8) IStep
// Equal clears all matching Equal steps
Equal(value ...int8) IStep
// GreaterOrEqualThan clears all matching GreaterOrEqualThan steps
GreaterOrEqualThan(value ...int8) IStep
// GreaterThan clears all matching GreaterThan steps
GreaterThan(value ...int8) IStep
// LessOrEqualThan clears all matching LessOrEqualThan steps
LessOrEqualThan(value ...int8) IStep
// LessThan clears all matching LessThan steps
LessThan(value ...int8) IStep
// NotBetween clears all matching NotBetween steps
NotBetween(value ...int8) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...int8) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...int8) IStep
// OneOf clears all matching OneOf steps
OneOf(value ...int8) IStep
}
IClearExpectInt8 provides methods to clear steps.
type IClearExpectInt16 ¶ added in v0.5.0
type IClearExpectInt16 interface {
IStep
// Between clears all matching Between steps
Between(value ...int16) IStep
// Equal clears all matching Equal steps
Equal(value ...int16) IStep
// GreaterOrEqualThan clears all matching GreaterOrEqualThan steps
GreaterOrEqualThan(value ...int16) IStep
// GreaterThan clears all matching GreaterThan steps
GreaterThan(value ...int16) IStep
// LessOrEqualThan clears all matching LessOrEqualThan steps
LessOrEqualThan(value ...int16) IStep
// LessThan clears all matching LessThan steps
LessThan(value ...int16) IStep
// NotBetween clears all matching NotBetween steps
NotBetween(value ...int16) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...int16) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...int16) IStep
// OneOf clears all matching OneOf steps
OneOf(value ...int16) IStep
}
IClearExpectInt16 provides methods to clear steps.
type IClearExpectInt32 ¶ added in v0.5.0
type IClearExpectInt32 interface {
IStep
// Between clears all matching Between steps
Between(value ...int32) IStep
// Equal clears all matching Equal steps
Equal(value ...int32) IStep
// GreaterOrEqualThan clears all matching GreaterOrEqualThan steps
GreaterOrEqualThan(value ...int32) IStep
// GreaterThan clears all matching GreaterThan steps
GreaterThan(value ...int32) IStep
// LessOrEqualThan clears all matching LessOrEqualThan steps
LessOrEqualThan(value ...int32) IStep
// LessThan clears all matching LessThan steps
LessThan(value ...int32) IStep
// NotBetween clears all matching NotBetween steps
NotBetween(value ...int32) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...int32) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...int32) IStep
// OneOf clears all matching OneOf steps
OneOf(value ...int32) IStep
}
IClearExpectInt32 provides methods to clear steps.
type IClearExpectInt64 ¶ added in v0.5.0
type IClearExpectInt64 interface {
IStep
// Between clears all matching Between steps
Between(value ...int64) IStep
// Equal clears all matching Equal steps
Equal(value ...int64) IStep
// GreaterOrEqualThan clears all matching GreaterOrEqualThan steps
GreaterOrEqualThan(value ...int64) IStep
// GreaterThan clears all matching GreaterThan steps
GreaterThan(value ...int64) IStep
// LessOrEqualThan clears all matching LessOrEqualThan steps
LessOrEqualThan(value ...int64) IStep
// LessThan clears all matching LessThan steps
LessThan(value ...int64) IStep
// NotBetween clears all matching NotBetween steps
NotBetween(value ...int64) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...int64) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...int64) IStep
// OneOf clears all matching OneOf steps
OneOf(value ...int64) IStep
}
IClearExpectInt64 provides methods to clear steps.
type IClearExpectString ¶ added in v0.5.0
type IClearExpectString interface {
IStep
// Contains clears all matching Contains steps
Contains(value ...string) IStep
// Equal clears all matching Equal steps
Equal(value ...string) IStep
// Len clears all matching Len steps
Len() IClearExpectInt
// NotContains clears all matching NotContains steps
NotContains(value ...string) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...string) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...string) IStep
// OneOf clears all matching OneOf steps
OneOf(value ...string) IStep
}
IClearExpectString provides methods to clear steps.
type IClearExpectUint ¶ added in v0.5.0
type IClearExpectUint interface {
IStep
// Between clears all matching Between steps
Between(value ...uint) IStep
// Equal clears all matching Equal steps
Equal(value ...uint) IStep
// GreaterOrEqualThan clears all matching GreaterOrEqualThan steps
GreaterOrEqualThan(value ...uint) IStep
// GreaterThan clears all matching GreaterThan steps
GreaterThan(value ...uint) IStep
// LessOrEqualThan clears all matching LessOrEqualThan steps
LessOrEqualThan(value ...uint) IStep
// LessThan clears all matching LessThan steps
LessThan(value ...uint) IStep
// NotBetween clears all matching NotBetween steps
NotBetween(value ...uint) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...uint) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...uint) IStep
// OneOf clears all matching OneOf steps
OneOf(value ...uint) IStep
}
IClearExpectUint provides methods to clear steps.
type IClearExpectUint8 ¶ added in v0.5.0
type IClearExpectUint8 interface {
IStep
// Between clears all matching Between steps
Between(value ...uint8) IStep
// Equal clears all matching Equal steps
Equal(value ...uint8) IStep
// GreaterOrEqualThan clears all matching GreaterOrEqualThan steps
GreaterOrEqualThan(value ...uint8) IStep
// GreaterThan clears all matching GreaterThan steps
GreaterThan(value ...uint8) IStep
// LessOrEqualThan clears all matching LessOrEqualThan steps
LessOrEqualThan(value ...uint8) IStep
// LessThan clears all matching LessThan steps
LessThan(value ...uint8) IStep
// NotBetween clears all matching NotBetween steps
NotBetween(value ...uint8) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...uint8) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...uint8) IStep
// OneOf clears all matching OneOf steps
OneOf(value ...uint8) IStep
}
IClearExpectUint8 provides methods to clear steps.
type IClearExpectUint16 ¶ added in v0.5.0
type IClearExpectUint16 interface {
IStep
// Between clears all matching Between steps
Between(value ...uint16) IStep
// Equal clears all matching Equal steps
Equal(value ...uint16) IStep
// GreaterOrEqualThan clears all matching GreaterOrEqualThan steps
GreaterOrEqualThan(value ...uint16) IStep
// GreaterThan clears all matching GreaterThan steps
GreaterThan(value ...uint16) IStep
// LessOrEqualThan clears all matching LessOrEqualThan steps
LessOrEqualThan(value ...uint16) IStep
// LessThan clears all matching LessThan steps
LessThan(value ...uint16) IStep
// NotBetween clears all matching NotBetween steps
NotBetween(value ...uint16) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...uint16) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...uint16) IStep
// OneOf clears all matching OneOf steps
OneOf(value ...uint16) IStep
}
IClearExpectUint16 provides methods to clear steps.
type IClearExpectUint32 ¶ added in v0.5.0
type IClearExpectUint32 interface {
IStep
// Between clears all matching Between steps
Between(value ...uint32) IStep
// Equal clears all matching Equal steps
Equal(value ...uint32) IStep
// GreaterOrEqualThan clears all matching GreaterOrEqualThan steps
GreaterOrEqualThan(value ...uint32) IStep
// GreaterThan clears all matching GreaterThan steps
GreaterThan(value ...uint32) IStep
// LessOrEqualThan clears all matching LessOrEqualThan steps
LessOrEqualThan(value ...uint32) IStep
// LessThan clears all matching LessThan steps
LessThan(value ...uint32) IStep
// NotBetween clears all matching NotBetween steps
NotBetween(value ...uint32) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...uint32) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...uint32) IStep
// OneOf clears all matching OneOf steps
OneOf(value ...uint32) IStep
}
IClearExpectUint32 provides methods to clear steps.
type IClearExpectUint64 ¶ added in v0.5.0
type IClearExpectUint64 interface {
IStep
// Between clears all matching Between steps
Between(value ...uint64) IStep
// Equal clears all matching Equal steps
Equal(value ...uint64) IStep
// GreaterOrEqualThan clears all matching GreaterOrEqualThan steps
GreaterOrEqualThan(value ...uint64) IStep
// GreaterThan clears all matching GreaterThan steps
GreaterThan(value ...uint64) IStep
// LessOrEqualThan clears all matching LessOrEqualThan steps
LessOrEqualThan(value ...uint64) IStep
// LessThan clears all matching LessThan steps
LessThan(value ...uint64) IStep
// NotBetween clears all matching NotBetween steps
NotBetween(value ...uint64) IStep
// NotEqual clears all matching NotEqual steps
NotEqual(value ...uint64) IStep
// NotOneOf clears all matching NotOneOf steps
NotOneOf(value ...uint64) IStep
// OneOf clears all matching OneOf steps
OneOf(value ...uint64) IStep
}
IClearExpectUint64 provides methods to clear steps.
type IClearSend ¶
type IClearSend interface {
IStep
// Body clears all matching Body steps
Body() IClearSendBody
// Custom clears all matching Custom steps
Custom(value ...Callback) IStep
// Headers clears all matching Headers steps
Headers(value ...string) IClearSendHeaders
// Trailers clears all matching Trailers steps
Trailers(value ...string) IClearSendHeaders
}
IClearSend provides methods to clear steps.
type IClearSendBody ¶
type IClearSendBody interface {
IStep
// Bool clears all matching Bool steps
Bool(value ...bool) IStep
// Bytes clears all matching Bytes steps
Bytes(value ...[]uint8) IStep
// Float32 clears all matching Float32 steps
Float32(value ...float32) IStep
// Float64 clears all matching Float64 steps
Float64(value ...float64) IStep
// FormValues clears all matching FormValues steps
FormValues(value ...string) IClearSendFormValues
// Int clears all matching Int steps
Int(value ...int) IStep
// Int16 clears all matching Int16 steps
Int16(value ...int16) IStep
// Int32 clears all matching Int32 steps
Int32(value ...int32) IStep
// Int64 clears all matching Int64 steps
Int64(value ...int64) IStep
// Int8 clears all matching Int8 steps
Int8(value ...int8) IStep
// JSON clears all matching JSON steps
JSON(value ...interface{}) IStep
// Reader clears all matching Reader steps
Reader(value ...io.Reader) IStep
// String clears all matching String steps
String(value ...string) IStep
// Uint clears all matching Uint steps
Uint(value ...uint) IStep
// Uint16 clears all matching Uint16 steps
Uint16(value ...uint16) IStep
// Uint32 clears all matching Uint32 steps
Uint32(value ...uint32) IStep
// Uint64 clears all matching Uint64 steps
Uint64(value ...uint64) IStep
// Uint8 clears all matching Uint8 steps
Uint8(value ...uint8) IStep
// XML clears all matching XML steps
XML(value ...interface{}) IStep
}
IClearSendBody provides methods to clear steps.
type IClearSendFormValues ¶ added in v0.5.0
type IClearSendFormValues interface {
IStep
// Add clears all matching Add steps
Add(value ...interface{}) IStep
}
IClearSendFormValues provides methods to clear steps.
type IClearSendHeaders ¶ added in v0.5.0
type IClearSendHeaders interface {
IStep
// Add clears all matching Add steps
Add(value ...interface{}) IStep
}
IClearSendHeaders provides methods to clear steps.
type IDebug ¶ added in v0.5.0
type IDebug interface {
IStep
// Time prints the current Time
Time() IStep
// Request prints the Request
//
// Usage:
// Debug().Request() // print the whole Request
// Debug().Request().Body() // print the body
// Debug().Request().Body().JSON().JQ(".Name") // print the Name value of the JSON body
// Debug().Request().Headers() // print all headers
// Debug().Request().Headers("Content-Type") // print the Content-Type header
Request() IDebugRequest
// Response prints the Response
//
// Usage:
// Debug().Response() // print the whole Response
// Debug().Response().Body() // print only the body
// Debug().Response().Body().JSON().JQ(".Name") // print the Name value of the JSON body
// Debug().Response().Headers() // print all headers
// Debug().Response().Headers("Content-Type") // print the Content-Type header
Response() IDebugResponse
}
IDebug provides a debug functionality for the Request and Response.
func Debug ¶
func Debug() IDebug
Debug prints the current Request and Response.
Examples:
MustDo(
Get("https://example.com"),
Debug(),
)
MustDo(
Get("https://example.com"),
Debug().Request().Headers(),
Debug().Response().Headers("Content-Type"),
)
type IDebugBody ¶ added in v0.5.0
type IDebugBody interface {
IStep
// Bytes prints the body contents as a byte slice
Bytes() IStep
// Bool prints the body contents as a bool type
Bool() IStep
// Float32 prints the body contents as a float32 type
Float32() IStep
// Float64 prints the body contents as a float64 type
Float64() IStep
// FormValues prints the body contents as FormValues
FormValues() IStep
// Int prints the body contents as a int type
Int() IStep
// Int8 prints the body contents as a int8 type
Int8() IStep
// Int16 prints the body contents as a int16 type
Int16() IStep
// Int32 prints the body contents as a int32 type
Int32() IStep
// Int64 prints the body contents as a int64 type
Int64() IStep
// JSON prints the body contents in the JSON format
//
// given the following body: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// Usage:
// Debug().Request().Body().JSON() // print the whole body
// Debug().Response().Body().JSON().JQ(".Name") // print "Joe"
JSON() IDebugBodyJSON
// String prints the body contents as a string type
String() IStep
// Uint prints the body contents as a uint type
Uint() IStep
// Uint8 prints the body contents as a uint8 type
Uint8() IStep
// Uint16 prints the body contents as a uint16 type
Uint16() IStep
// Uint32 prints the body contents as a uint32 type
Uint32() IStep
// Uint64 prints the body contents as a uint64 type
Uint64() IStep
}
IDebugBody defines the debug functions that are available for the http request/response body.
type IDebugBodyJSON ¶ added in v0.5.0
type IDebugBodyJSON interface {
IStep
// JQ runs an jq expression on the JSON body and prints the result
//
// given the following body: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// Usage:
// Debug().Response().Body().JSON().JQ(".Name") // print "Joe"
JQ(expression ...string) IStep
}
IDebugBodyJSON defines the debug functions that are available for the http request/response body in JSON format.
type IDebugRequest ¶ added in v0.5.0
type IDebugRequest interface {
IStep
// Method prints the Request's Method
Method() IStep
// URL prints the Request's URL
//
// The argument can be used to narrow down the print path
//
// Usage:
// Debug().Request().URL() // print the whole URL struct
URL() IStep
// Proto prints the Request's Proto
Proto() IStep
// ProtoMajor prints the Request's ProtoMajor
ProtoMajor() IStep
// ProtoMinor prints the Request's ProtoMinor
ProtoMinor() IStep
// ContentLength prints the Request's ContentLength
ContentLength() IStep
// TransferEncoding prints the Request's TransferEncoding
TransferEncoding() IStep
// Host prints the Request's Host
Host() IStep
// Headers prints the Request's Headers
//
// If you omit the argument it will print all headers.
//
// Usage:
// Debug().Request().Headers() // all headers
// Debug().Request().Headers("Content-Type") // only Content-Type
Headers(header ...string) IStep
// Trailers prints the Request's Trailers
//
// If you omit the argument it will print all trailers.
//
// Usage:
// Debug().Request().Trailers() // all trailers
// Debug().Request().Trailers("Content-Type") // only Content-Type
Trailers(header ...string) IStep
// Body prints the Request's Body
//
// The argument can be used to narrow down the print path
//
// given the following body: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// Usage:
// Debug().Request().Body() // will print the whole Body
// Debug().Request().Body().JSON() // will print the whole Body as JSON data
// Debug().Request().Body().JSON().JQ(".ID") // will print 10
// Debug().Request().Body().JSON().JQ(".Name") // will print "Name"
// Debug().Request().Body().JSON().JQ(".Roles") // will print ["Admin", "User"]
// Debug().Request().Body().JSON().JQ(".Roles.0") // will print "Admin"
Body() IDebugBody
}
IDebugRequest defines the debug functions that are available for the http request.
type IDebugResponse ¶ added in v0.5.0
type IDebugResponse interface {
IStep
// Proto will print the Response's Proto
Proto() IStep
// ProtoMajor will print the Response's ProtoMajor
ProtoMajor() IStep
// ProtoMinor will print the Response's ProtoMinor
ProtoMinor() IStep
// ContentLength will print the Response's ContentLength
ContentLength() IStep
// TransferEncoding will print the Response's TransferEncoding
TransferEncoding() IStep
// Status will print the Response's Status
Status() IStep
// StatusCode will print the Response's StatusCode
StatusCode() IStep
// Headers prints the Response's Headers
//
// If you omit the header it will print all headers.
//
// Usage:
// Debug().Response().Headers() // all headers
// Debug().Response().Headers("Content-Type") // only Content-Type
Headers(header ...string) IStep
// Trailers prints the Response's Trailers
//
// If you omit the trailer it will print all trailers.
//
// Usage:
// Debug().Response().Trailers() // all trailers
// Debug().Response().Trailers("Content-Type") // only Content-Type
Trailers(trailer ...string) IStep
// Body prints the Response's Body
//
// The argument can be used to narrow down the print path
//
// given the following body: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// Usage:
// Debug().Request().Body() // will print the whole Body
// Debug().Request().Body().JSON() // will print the whole Body
// Debug().Request().Body().JSON().JQ(".ID") // will print 10
// Debug().Request().Body().JSON().JQ(".Name") // will print "Name"
// Debug().Request().Body().JSON().JQ(".Roles") // will print ["Admin", "User"]
// Debug().Request().Body().JSON().JQ(".Roles.0") // will print "Admin"
Body() IDebugBody
}
IDebugResponse defines the debug functions that are available for the http response.
type IExpect ¶
type IExpect interface {
// Custom can be used to expect a custom behavior.
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Custom(func(hit Hit) error {
// if hit.Response().StatusCode != 200 {
// return errors.New("Expected 200")
// }
// return nil
// }),
// )
Custom(fn Callback) IStep
// Body provides assertions for the body
//
// Usage:
// Expect().Body().String().Equal("Hello World")
// Expect().Body().JSON().Equal(map[string]interface{}{"Name": "Joe"})
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Body().String().Contains("Hello World"),
// )
Body() IExpectBody
// Headers provides assertions to one specific response headers.
//
// If you specify the argument you can directly assert a specific header
//
// Usage:
// Expect().Headers("Content-Type").NotEmpty()
// Expect().Headers("Content-Type").Equal("application/json")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Headers("Content-Type").NotEmpty(),
// Expect().Headers("Content-Type").Equal("text/plain; charset=utf-8"),
// )
Headers(headerName string) IExpectHeaders
// Status provides assertions to the response status code
//
// Usage:
// Expect().Status().Equal(http.StatusOK)
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Status().LessThan(http.StatusBadRequest),
// )
Status() IExpectInt64
// Trailers provides assertions to the response trailers.
//
// If you specify the argument you can directly assert a specific trailer
//
// Usage:
// Expect().Trailers("X-CustomTrailer").NotEmpty()
// Expect().Trailers("X-CustomTrailer").Equal("Foo")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Trailers("X-CustomTrailer").Empty(),
// Expect().Trailers("X-CustomTrailer").NotEqual("Foo"),
// )
Trailers(trailerName string) IExpectHeaders
}
IExpect provides assertions on the http response.
type IExpectBody ¶
type IExpectBody interface {
// Bytes expects the body to be equal the specified byte slice.
//
// Usage:
// Expect().Body().Bytes().Equal([]byte("Hello World"))
// Expect().Body().Bytes().Contains([]byte("H"))
Bytes() IExpectBytes
// FormValues expects the body to be equal to the specified FormValues
//
// Usage:
// Expect().Body().FormValues("username").Equal("joe")
FormValues(name string) IExpectFormValues
// Float32 expects the body to be equal the specified int.
//
// Usage:
// Expect().Body().Float32().Equal(0.0)
// Expect().Body().Float32().GreaterThan(5.0)
Float32() IExpectFloat32
// Float64 expects the body to be equal the specified int.
//
// Usage:
// Expect().Body().Float64().Equal(0.0)
// Expect().Body().Float64().GreaterThan(5.0)
Float64() IExpectFloat64
// Int expects the body to be equal the specified int.
//
// Usage:
// Expect().Body().Int().Equal(0)
// Expect().Body().Int().GreaterThan(5)
Int() IExpectInt
// Int8 expects the body to be equal the specified int8.
//
// Usage:
// Expect().Body().Int8().Equal(0)
// Expect().Body().Int8().GreaterThan(5)
Int8() IExpectInt8
// Int16 expects the body to be equal the specified int16.
//
// Usage:
// Expect().Body().Int16().Equal(0)
// Expect().Body().Int16().GreaterThan(5)
Int16() IExpectInt16
// Int32 expects the body to be equal the specified int32.
//
// Usage:
// Expect().Body().Int32().Equal(0)
// Expect().Body().Int32().GreaterThan(5)
Int32() IExpectInt32
// Int64 expects the body to be equal the specified int64.
//
// Usage:
// Expect().Body().Int64().Equal(0)
// Expect().Body().Int64().GreaterThan(5)
Int64() IExpectInt64
// JSON provides assertions for the body in the JSON format
//
// Usage:
// Expect().Body().JSON().Equal([]int{1, 2, 3})
// Expect().Body().JSON().Contains(1)
// Expect().Body().JSON().JQ(".Name").Equal("Joe")
JSON() IExpectBodyJSON
// String expects the body to be equal the specified string.
//
// Usage:
// Expect().Body().String().Equal("Hello World")
// Expect().Body().String().Contains("Hello")
String() IExpectString
// Uint expects the body to be equal the specified uint.
//
// Usage:
// Expect().Body().Uint().Equal(0)
// Expect().Body().Uint().GreaterThan(5)
Uint() IExpectUint
// Uint8 expects the body to be equal the specified uint8.
//
// Usage:
// Expect().Body().Uint8().Equal(0)
// Expect().Body().Uint8().GreaterThan(5)
Uint8() IExpectUint8
// Uint16 expects the body to be equal the specified uint16.
//
// Usage:
// Expect().Body().Uint16().Equal(0)
// Expect().Body().Uint16().GreaterThan(5)
Uint16() IExpectUint16
// Uint32 expects the body to be equal the specified uint32.
//
// Usage:
// Expect().Body().Uint32().Equal(0)
// Expect().Body().Uint32().GreaterThan(5)
Uint32() IExpectUint32
// Uint64 expects the body to be equal the specified uint64.
//
// Usage:
// Expect().Body().Uint64().Equal(0)
// Expect().Body().Uint64().GreaterThan(5)
Uint64() IExpectUint64
}
IExpectBody provides assertions on the http response body.
type IExpectBodyJSON ¶
type IExpectBodyJSON interface {
// Equal expects the json body to be equal to the specified value.
//
// given the following response: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// Usage:
// Expect().Body().JSON().Equal(map[string]interface{}{"ID": 10, "Name": "Joe", "Roles": []string{"Admin", "User"}})
Equal(data interface{}) IStep
// NotEqual expects the json body to be not equal to the specified value.
//
// see Equal() for usage and examples
NotEqual(data ...interface{}) IStep
// Contains expects the json body to contain the specified value.
//
// given the following response: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// Usage:
// Expect().Body().JSON().Contains("ID")
Contains(data ...interface{}) IStep
// NotContains expects the json body to not contain the specified value.
//
// see Contains() for usage and examples
NotContains(data ...interface{}) IStep
// JQ runs an jq expression on the JSON body, the result can be asserted
//
// given the following response: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// Usage:
// Expect().Body().JSON().JQ(".Name").Equal("Joe")
// Expect().Body().JSON().JQ(".Roles").Equal([]string{"Admin", "User"})
// Expect().Body().JSON().JQ(".Roles.[0]").Equal("Admin")
JQ(expression ...string) IExpectBodyJSONJQ
// Len provides assertions to the json body size
//
// Usage:
// Expect().Body().JSON().Len().Equal(10)
Len() IExpectInt
}
IExpectBodyJSON provides assertions on the http response json body.
type IExpectBodyJSONJQ ¶ added in v0.5.0
type IExpectBodyJSONJQ interface {
// Equal expects the json body to be equal to the specified value.
//
// given the following response: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// Usage:
// Expect().Body().JSON().JQ(".").Equal(map[string]interface{}{"ID": 10, "Name": "Joe", "Roles": []string{"Admin", "User"}})
// Expect().Body().JSON().JQ(".Name").Equal("Joe")
// Expect().Body().JSON().JQ(".Roles").Equal([]string{"Admin", "User"})
// Expect().Body().JSON().JQ(".Roles.[0]").Equal("Admin")
//
// Example:
// // given the following response: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// MustDo(
// Get("https://example.com/json"),
// Expect().Body().JSON().JQ(".").Equal(map[string]interface{}{"ID": 10, "Name": "Joe", "Roles": []string{"Admin", "User"}}),
// Expect().Body().JSON().JQ(".Name").Equal("Joe"),
// Expect().Body().JSON().JQ(".Roles").Equal([]string{"Admin", "User"}),
// Expect().Body().JSON().JQ(".Roles.[0]").Equal("Admin"),
// )
Equal(data interface{}) IStep
// NotEqual expects the json body to be equal to the specified value.
//
// see Equal() for usage and examples
NotEqual(data ...interface{}) IStep
// Contains expects the json body to be equal to the specified value.
//
// given the following response: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// Usage:
// Expect().Body().JSON().JQ(".").Contains("ID")
// Expect().Body().JSON().JQ(".Name").Contains("J")
// Expect().Body().JSON().JQ(".Roles").Contains("Admin")
//
// Example:
// // given the following response: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// MustDo(
// Get("https://example.com/json"),
// Expect().Body().JSON().JQ(".").Contains("ID"),
// Expect().Body().JSON().JQ(".Name").Contains("J"),
// Expect().Body().JSON().JQ(".Roles").Contains("Admin"),
// )
Contains(data ...interface{}) IStep
// NotContains expects the json body to be equal to the specified value.
//
// see Contains() for usage and examples
NotContains(data ...interface{}) IStep
// Len provides assertions to the json object size
//
// Usage:
// Expect().Body().JSON().JQ(".Name").Len().Equal(10)
Len() IExpectInt
// JQ runs an additional jq expression
JQ(expression ...string) IExpectBodyJSONJQ
}
IExpectBodyJSONJQ provides assertions on the http response json body.
type IExpectBytes ¶ added in v0.5.0
type IExpectBytes interface {
// Equal expects the body to be equal to the specified value.
//
// Usage:
// Expect().Body().Bytes().Equal([]byte("Hello World"))
Equal(value []byte) IStep
// NotEqual expects the body to be not equal to the specified value
//
// Usage:
// Expect().Body().Bytes().NotEqual([]byte("Hello World"))
NotEqual(value []byte) IStep
// Contains expects the body to contain the specified value.
//
// Usage:
// Expect().Body().Bytes().Contains([]byte("Hello World"))
Contains(value []byte) IStep
// NotContains expects the body to not contain the specified value.
//
// Usage:
// Expect().Body().Bytes().NotContains([]byte("Hello World"))
NotContains(value []byte) IStep
// Len provides assertions to the body size.
//
// Usage:
// Expect().Body().Bytes().Len().Equal(10)
Len() IExpectInt
}
IExpectBytes provides assertions for the byte slice type.
type IExpectFloat32 ¶ added in v0.5.0
type IExpectFloat32 interface {
// Equal expects the float32 to be equal to the specified value.
Equal(value float32) IStep
// NotEqual expects the float32 to be not equal to the specified value.
NotEqual(value ...float32) IStep
// OneOf expects the float32 to be equal to one of the specified values.
OneOf(values ...float32) IStep
// NotOneOf expects the float32 to be not equal to one of the specified values.
NotOneOf(values ...float32) IStep
// GreaterThan expects the float32 to be not greater than the specified value.
GreaterThan(value float32) IStep
// LessThan expects the float32 to be less than the specified value.
LessThan(value float32) IStep
// GreaterOrEqualThan expects the float32 to be greater or equal than the specified value.
GreaterOrEqualThan(value float32) IStep
// LessOrEqualThan expects the float32 to be less or equal than the specified value.
LessOrEqualThan(value float32) IStep
// Between expects the float32 to be between the specified min and max value (inclusive, min >= float32 >= max).
Between(min, max float32) IStep
// NotBetween expects the float32 to be not between the specified min and max value (inclusive, min >= float32 >= max).
NotBetween(min, max float32) IStep
}
IExpectFloat32 provides assertions for the float32 type.
type IExpectFloat64 ¶ added in v0.5.0
type IExpectFloat64 interface {
// Equal expects the float64 to be equal to the specified value.
Equal(value float64) IStep
// NotEqual expects the float64 to be not equal to the specified value.
NotEqual(value ...float64) IStep
// OneOf expects the float64 to be equal to one of the specified values.
OneOf(values ...float64) IStep
// NotOneOf expects the float64 to be not equal to one of the specified values.
NotOneOf(values ...float64) IStep
// GreaterThan expects the float64 to be not greater than the specified value.
GreaterThan(value float64) IStep
// LessThan expects the float64 to be less than the specified value.
LessThan(value float64) IStep
// GreaterOrEqualThan expects the float64 to be greater or equal than the specified value.
GreaterOrEqualThan(value float64) IStep
// LessOrEqualThan expects the float64 to be less or equal than the specified value.
LessOrEqualThan(value float64) IStep
// Between expects the float64 to be between the specified min and max value (inclusive, min >= float64 >= max).
Between(min, max float64) IStep
// NotBetween expects the float64 to be not between the specified min and max value (inclusive, min >= float64 >= max).
NotBetween(min, max float64) IStep
}
IExpectFloat64 provides assertions for the float64 type.
type IExpectFormValues ¶ added in v0.5.0
type IExpectFormValues interface {
// Contains expects the specific header to contain all of the specified values.
//
// Usage:
// Expect().Body().FormValues("username").Contains("joe")
Contains(values ...interface{}) IStep
// NotContains expects the specified header to not contain all of the specified values.
//
// Usage:
// Expect().Body().FormValues("username").NotContains("joe")
NotContains(values ...interface{}) IStep
// OneOf expects the specified header to contain one of the specified values.
//
// Usage:
// Expect().Body().FormValues("username").OneOf("joe", "alice")
OneOf(values ...interface{}) IStep
// NotOneOf expects the specified header to not contain one of the specified values.
//
// Usage:
// Expect().Body().FormValues("username").NotOneOf("joe", "alice")
NotOneOf(values ...interface{}) IStep
// Empty expects the specified header to be empty.
//
// Usage:
// Expect().Body().FormValues("username").Empty()
Empty() IStep
// NotEmpty expects the specified header to be empty.
//
// Usage:
// Expect().Body().FormValues("username").NotEmpty()
NotEmpty() IStep
// Len expects the specified header to be the same length then specified.
//
// Usage:
// Expect().Body().FormValues("username").Len().GreaterThan(0)
Len() IExpectInt
// Equal expects the specified header to be equal the specified value.
//
// Usage:
// Expect().Body().FormValues("username").Equal("joe")
// Expect().Body().FormValues("usernames").Equal("joe", "alice")
// Expect().Body().FormValues("length").Equal(10)
Equal(value ...interface{}) IStep
// NotEqual expects the specified header to be not equal the specified value.
//
// Usage:
// Expect().Body().FormValues("username").NotEqual("joe")
// Expect().Body().FormValues("usernames").NotEqual("joe", "alice")
// Expect().Body().FormValues("length").NotEqual(10)
NotEqual(value ...interface{}) IStep
// First provides assertions for the first value of the specified form value.
//
// Usage:
// Expect().Body().FormValues("username").First().NotEqual("joe")
First() IExpectHeaderValue
// Last provides assertions for the last value of the specified header.
//
// Usage:
// Expect().Body().FormValues("username").Last().NotEqual("joe")
Last() IExpectHeaderValue
// Nth provides assertions for the nth value of the specified header. (0 = first value)
//
// Usage:
// Expect().Body().FormValues("username").Nth(0).NotEqual("joe")
Nth(n int) IExpectHeaderValue
}
IExpectFormValues provides assertions on the http response body FormValues.
type IExpectHeaderValue ¶ added in v0.5.21
type IExpectHeaderValue interface {
// Contains expects the specific header value to contain all of the specified values.
//
// Usage:
// Expect().Headers("Content-Type").First().Contains("application/json")
// Expect().Trailers("X-Trailer1").First().Contains("secret")
//
// Example:
// MustDo(
// Get("https://example.com/json"),
// Expect().Headers("Content-Type").First().Contains("application/json"),
// )
Contains(values ...interface{}) IStep
// NotContains expects the specified header value to not contain all of the specified values.
//
// Usage:
// Expect().Headers("Content-Type").First().NotContains("application/json")
// Expect().Trailers("X-Trailer").First().NotContains("secret")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Headers("Content-Type").First().NotContains("json"),
// )
NotContains(values ...interface{}) IStep
// OneOf expects the specified header value to contain one of the specified values.
//
// Usage:
// Expect().Headers("Content-Type").First().OneOf("application/json", "text/json")
// Expect().Trailers("X-Trailer1").First().OneOf("foo", "bar")
//
// Example:
// MustDo(
// Get("https://example.com/json"),
// Expect().Headers("Content-Type").First().OneOf("application/json", "text/json"),
// )
OneOf(values ...interface{}) IStep
// NotOneOf expects the specified header value to not contain one of the specified values.
//
// Usage:
// Expect().Headers("Content-Type").First().NotOneOf("application/json", "text/json")
// Expect().Trailers("X-Trailer1").First().NotOneOf("foo", "bar")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Headers("Content-Type").First().NotOneOf("application/json", "text/json"),
// )
NotOneOf(values ...interface{}) IStep
// Empty expects the specified header value to be empty.
//
// Usage:
// Expect().Headers("Content-Type").First().Empty()
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Headers("Authentication").First().Empty(),
// )
Empty() IStep
// Empty expects the specified header value to not be empty.
//
// Usage:
// Expect().Headers("Content-Type").First().NotEmpty()
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Headers("Content-Type").First().NotEmpty(),
// )
NotEmpty() IStep
// Len expects the specified header value to be the same length then specified.
//
// Usage:
// Expect().Headers("Content-Type").First().Len().GreaterThan(0)
// Expect().Trailers("X-Trailer1").First().Len().GreaterThan(0)
//
// Example:
// MustDo(
// Get("https://example.com/json"),
// Expect().Headers("Content-Type").First().Len().GreaterThan(0),
// )
Len() IExpectInt
// Equal expects the specified header value to be equal the specified value.
//
// Usage:
// Expect().Headers("Content-Type").First().Equal("application/json")
// Expect().Headers("Content-Length").First().Equal(11)
// Expect().Trailers("X-Trailer1").First().Equal("data")
//
// Example:
// MustDo(
// Get("https://example.com/json"),
// Expect().Headers("Content-Type").First().Equal("application/json"),
// )
Equal(value interface{}) IStep
// NotEqual expects the specified header value to be not equal to one of the specified values.
//
// Usage:
// Expect().Headers("Content-Type").First().NotEqual("application/json")
// Expect().Headers("Content-Length").First().NotEqual(11)
// Expect().Trailers("X-Trailer1").First().NotEqual("data")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Headers("Content-Type").First().NotEqual("application/json"),
// )
NotEqual(value ...interface{}) IStep
}
IExpectHeaderValue provides assertions on the http response header value.
type IExpectHeaders ¶ added in v0.5.0
type IExpectHeaders interface {
// Contains expects the specific header to contain all of the specified values.
//
// Usage:
// Expect().Headers("Content-Type").Contains("application/json")
// Expect().Trailers("X-Trailer1").Contains("secret")
//
// Example:
// MustDo(
// Get("https://example.com/json"),
// Expect().Headers("Content-Type").Contains("application/json"),
// )
Contains(values ...interface{}) IStep
// NotContains expects the specified header to not contain all of the specified values.
//
// Usage:
// Expect().Headers("Content-Type").NotContains("application/json")
// Expect().Trailers("X-Trailer").NotContains("secret")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Headers("Content-Type").NotContains("json"),
// )
NotContains(values ...interface{}) IStep
// OneOf expects the specified header to contain one of the specified values.
//
// Usage:
// Expect().Headers("Content-Type").OneOf("application/json", "text/json")
// Expect().Trailers("X-Trailer1").OneOf("foo", "bar")
//
// Example:
// MustDo(
// Get("https://example.com/json"),
// Expect().Headers("Content-Type").OneOf("application/json", "text/json"),
// )
OneOf(values ...interface{}) IStep
// NotOneOf expects the specified header to not contain one of the specified values.
//
// Usage:
// Expect().Headers("Content-Type").NotOneOf("application/json", "text/json")
// Expect().Trailers("X-Trailer1").NotOneOf("foo", "bar")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Headers("Content-Type").NotOneOf("application/json", "text/json"),
// )
NotOneOf(values ...interface{}) IStep
// Empty expects the specified header to be empty.
//
// Usage:
// Expect().Headers("Content-Type").Empty()
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Headers("Authentication").Empty(),
// )
Empty() IStep
// Empty expects the specified header to not be empty.
//
// Usage:
// Expect().Headers("Content-Type").NotEmpty()
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Headers("Content-Type").NotEmpty(),
// )
NotEmpty() IStep
// Len provides assertions for the length of the specified header.
//
// Usage:
// Expect().Headers("Content-Type").Len().GreaterThan(0)
// Expect().Trailers("X-Trailer1").Len().GreaterThan(0)
//
// Example:
// MustDo(
// Get("https://example.com/json"),
// Expect().Headers("Content-Type").Len().GreaterThan(0),
// )
Len() IExpectInt
// Equal expects the specified header to be equal the specified value.
//
// Usage:
// Expect().Headers("Content-Type").Equal("application/json")
// Expect().Headers("Content-Length").Equal(11)
// Expect().Trailers("X-Trailer1").Equal("data")
//
// Example:
// MustDo(
// Get("https://example.com/json"),
// Expect().Headers("Content-Type").Equal("application/json"),
// )
Equal(value ...interface{}) IStep
// NotEqual expects the specified header to be not equal the specified value.
//
// Usage:
// Expect().Headers("Content-Type").NotEqual("application/json")
// Expect().Headers("Content-Length").NotEqual(11)
// Expect().Trailers("X-Trailer1").NotEqual("data")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Headers("Content-Type").NotEqual("application/json"),
// )
NotEqual(value ...interface{}) IStep
// First provides assertions for the first value of the specified header.
//
// Usage:
// Expect().Headers("Content-Type").First().NotEqual("application/json")
// Expect().Headers("Content-Length").First().NotEqual(11)
// Expect().Trailers("X-Trailer1").First().NotEqual("data")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Headers("Content-Type").First().NotEqual("application/json"),
// )
First() IExpectHeaderValue
// Last provides assertions for the last value of the specified header.
//
// Usage:
// Expect().Headers("Content-Type").Last().NotEqual("application/json")
// Expect().Headers("Content-Length").Last().NotEqual(11)
// Expect().Trailers("X-Trailer1").Last().NotEqual("data")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Headers("Content-Type").Last().NotEqual("application/json"),
// )
Last() IExpectHeaderValue
// Nth provides assertions for the nth value of the specified header. (0 = first value)
//
// Usage:
// Expect().Headers("Content-Type").Nth(0).NotEqual("application/json")
// Expect().Headers("Content-Length").Nth(0).NotEqual(11)
// Expect().Trailers("X-Trailer1").Nth(0).NotEqual("data")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Expect().Headers("Content-Type").Nth(0).NotEqual("application/json"),
// )
Nth(n int) IExpectHeaderValue
}
IExpectHeaders provides assertions on the http response header.
type IExpectInt ¶ added in v0.5.0
type IExpectInt interface {
// Equal expects the int to be equal to the specified value.
Equal(value int) IStep
// NotEqual expects the int to be not equal to the specified value.
NotEqual(value ...int) IStep
// OneOf expects the int to be equal to one of the specified values.
OneOf(values ...int) IStep
// NotOneOf expects the int to be not equal to one of the specified values.
NotOneOf(values ...int) IStep
// GreaterThan expects the int to be not greater than the specified value.
GreaterThan(value int) IStep
// LessThan expects the int to be less than the specified value.
LessThan(value int) IStep
// GreaterOrEqualThan expects the int to be greater or equal than the specified value.
GreaterOrEqualThan(value int) IStep
// LessOrEqualThan expects the int to be less or equal than the specified value.
LessOrEqualThan(value int) IStep
// Between expects the int to be between the specified min and max value (inclusive, min >= int >= max).
Between(min, max int) IStep
// NotBetween expects the int to be not between the specified min and max value (inclusive, min >= int >= max).
NotBetween(min, max int) IStep
}
IExpectInt provides assertions for the int type.
type IExpectInt8 ¶ added in v0.5.0
type IExpectInt8 interface {
// Equal expects the int8 to be equal to the specified value.
Equal(value int8) IStep
// NotEqual expects the int8 to be not equal to the specified value.
NotEqual(value ...int8) IStep
// OneOf expects the int8 to be equal to one of the specified values.
OneOf(values ...int8) IStep
// NotOneOf expects the int8 to be not equal to one of the specified values.
NotOneOf(values ...int8) IStep
// GreaterThan expects the int8 to be not greater than the specified value.
GreaterThan(value int8) IStep
// LessThan expects the int8 to be less than the specified value.
LessThan(value int8) IStep
// GreaterOrEqualThan expects the int8 to be greater or equal than the specified value.
GreaterOrEqualThan(value int8) IStep
// LessOrEqualThan expects the int8 to be less or equal than the specified value.
LessOrEqualThan(value int8) IStep
// Between expects the int8 to be between the specified min and max value (inclusive, min >= int8 >= max).
Between(min, max int8) IStep
// NotBetween expects the int8 to be not between the specified min and max value (inclusive, min >= int8 >= max).
NotBetween(min, max int8) IStep
}
IExpectInt8 provides assertions for the int8 type.
type IExpectInt16 ¶ added in v0.5.0
type IExpectInt16 interface {
// Equal expects the int16 to be equal to the specified value.
Equal(value int16) IStep
// NotEqual expects the int16 to be not equal to the specified value.
NotEqual(value ...int16) IStep
// OneOf expects the int16 to be equal to one of the specified values.
OneOf(values ...int16) IStep
// NotOneOf expects the int16 to be not equal to one of the specified values.
NotOneOf(values ...int16) IStep
// GreaterThan expects the int16 to be not greater than the specified value.
GreaterThan(value int16) IStep
// LessThan expects the int16 to be less than the specified value.
LessThan(value int16) IStep
// GreaterOrEqualThan expects the int16 to be greater or equal than the specified value.
GreaterOrEqualThan(value int16) IStep
// LessOrEqualThan expects the int16 to be less or equal than the specified value.
LessOrEqualThan(value int16) IStep
// Between expects the int16 to be between the specified min and max value (inclusive, min >= int16 >= max).
Between(min, max int16) IStep
// NotBetween expects the int16 to be not between the specified min and max value (inclusive, min >= int16 >= max).
NotBetween(min, max int16) IStep
}
IExpectInt16 provides assertions for the int16 type.
type IExpectInt32 ¶ added in v0.5.0
type IExpectInt32 interface {
// Equal expects the int32 to be equal to the specified value.
Equal(value int32) IStep
// NotEqual expects the int32 to be not equal to the specified value.
NotEqual(value ...int32) IStep
// OneOf expects the int32 to be equal to one of the specified values.
OneOf(values ...int32) IStep
// NotOneOf expects the int32 to be not equal to one of the specified values.
NotOneOf(values ...int32) IStep
// GreaterThan expects the int32 to be not greater than the specified value.
GreaterThan(value int32) IStep
// LessThan expects the int32 to be less than the specified value.
LessThan(value int32) IStep
// GreaterOrEqualThan expects the int32 to be greater or equal than the specified value.
GreaterOrEqualThan(value int32) IStep
// LessOrEqualThan expects the int32 to be less or equal than the specified value.
LessOrEqualThan(value int32) IStep
// Between expects the int32 to be between the specified min and max value (inclusive, min >= int32 >= max).
Between(min, max int32) IStep
// NotBetween expects the int32 to be not between the specified min and max value (inclusive, min >= int32 >= max).
NotBetween(min, max int32) IStep
}
IExpectInt32 provides assertions for the int32 type.
type IExpectInt64 ¶ added in v0.5.0
type IExpectInt64 interface {
// Equal expects the int64 to be equal to the specified value.
Equal(value int64) IStep
// NotEqual expects the int64 to be not equal to the specified value.
NotEqual(value ...int64) IStep
// OneOf expects the int64 to be equal to one of the specified values.
OneOf(values ...int64) IStep
// NotOneOf expects the int64 to be not equal to one of the specified values.
NotOneOf(values ...int64) IStep
// GreaterThan expects the int64 to be not greater than the specified value.
GreaterThan(value int64) IStep
// LessThan expects the int64 to be less than the specified value.
LessThan(value int64) IStep
// GreaterOrEqualThan expects the int64 to be greater or equal than the specified value.
GreaterOrEqualThan(value int64) IStep
// LessOrEqualThan expects the int64 to be less or equal than the specified value.
LessOrEqualThan(value int64) IStep
// Between expects the int64 to be between the specified min and max value (inclusive, min >= int64 >= max).
Between(min, max int64) IStep
// NotBetween expects the int64 to be not between the specified min and max value (inclusive, min >= int64 >= max).
NotBetween(min, max int64) IStep
}
IExpectInt64 provides assertions for the int64 type.
type IExpectString ¶ added in v0.5.0
type IExpectString interface {
// Equal expects the string to be equal to the specified value.
Equal(value string) IStep
// NotEqual expects the string to be not equal to the specified value.
NotEqual(value string) IStep
// Contains expects the string to contain the specified value.
Contains(value string) IStep
// NotContains expects the string to not contain the specified value.
NotContains(value string) IStep
// Len provides assertions to the string size.
Len() IExpectInt
// OneOf expects the string to be equal to one of the specified values.
OneOf(values ...string) IStep
// NotOneOf expects the string to be not equal to one of the specified values.
NotOneOf(values ...string) IStep
}
IExpectString provides assertions for the string type.
type IExpectUint ¶ added in v0.5.0
type IExpectUint interface {
// Equal expects the uint to be equal to the specified value.
Equal(value uint) IStep
// NotEqual expects the uint to be not equal to the specified value.
NotEqual(value ...uint) IStep
// OneOf expects the uint to be equal to one of the specified values.
OneOf(values ...uint) IStep
// NotOneOf expects the uint to be not equal to one of the specified values.
NotOneOf(values ...uint) IStep
// GreaterThan expects the uint to be not greater than the specified value.
GreaterThan(value uint) IStep
// LessThan expects the uint to be less than the specified value.
LessThan(value uint) IStep
// GreaterOrEqualThan expects the uint to be greater or equal than the specified value.
GreaterOrEqualThan(value uint) IStep
// LessOrEqualThan expects the uint to be less or equal than the specified value.
LessOrEqualThan(value uint) IStep
// Between expects the uint to be between the specified min and max value (inclusive, min >= uint >= max).
Between(min, max uint) IStep
// NotBetween expects the uint to be not between the specified min and max value (inclusive, min >= uint >= max).
NotBetween(min, max uint) IStep
}
IExpectUint provides assertions for the uint type.
type IExpectUint8 ¶ added in v0.5.0
type IExpectUint8 interface {
// Equal expects the uint8 to be equal to the specified value.
Equal(value uint8) IStep
// NotEqual expects the uint8 to be not equal to the specified value.
NotEqual(value ...uint8) IStep
// OneOf expects the uint8 to be equal to one of the specified values.
OneOf(values ...uint8) IStep
// NotOneOf expects the uint8 to be not equal to one of the specified values.
NotOneOf(values ...uint8) IStep
// GreaterThan expects the uint8 to be not greater than the specified value.
GreaterThan(value uint8) IStep
// LessThan expects the uint8 to be less than the specified value.
LessThan(value uint8) IStep
// GreaterOrEqualThan expects the uint8 to be greater or equal than the specified value.
GreaterOrEqualThan(value uint8) IStep
// LessOrEqualThan expects the uint8 to be less or equal than the specified value.
LessOrEqualThan(value uint8) IStep
// Between expects the uint8 to be between the specified min and max value (inclusive, min >= uint8 >= max).
Between(min, max uint8) IStep
// NotBetween expects the uint8 to be not between the specified min and max value (inclusive, min >= uint8 >= max).
NotBetween(min, max uint8) IStep
}
IExpectUint8 provides assertions for the uint8 type.
type IExpectUint16 ¶ added in v0.5.0
type IExpectUint16 interface {
// Equal expects the uint16 to be equal to the specified value.
Equal(value uint16) IStep
// NotEqual expects the uint16 to be not equal to the specified value.
NotEqual(value ...uint16) IStep
// OneOf expects the uint16 to be equal to one of the specified values.
OneOf(values ...uint16) IStep
// NotOneOf expects the uint16 to be not equal to one of the specified values.
NotOneOf(values ...uint16) IStep
// GreaterThan expects the uint16 to be not greater than the specified value.
GreaterThan(value uint16) IStep
// LessThan expects the uint16 to be less than the specified value.
LessThan(value uint16) IStep
// GreaterOrEqualThan expects the uint16 to be greater or equal than the specified value.
GreaterOrEqualThan(value uint16) IStep
// LessOrEqualThan expects the uint16 to be less or equal than the specified value.
LessOrEqualThan(value uint16) IStep
// Between expects the uint16 to be between the specified min and max value (inclusive, min >= uint16 >= max).
Between(min, max uint16) IStep
// NotBetween expects the uint16 to be not between the specified min and max value (inclusive, min >= uint16 >= max).
NotBetween(min, max uint16) IStep
}
IExpectUint16 provides assertions for the uint16 type.
type IExpectUint32 ¶ added in v0.5.0
type IExpectUint32 interface {
// Equal expects the uint32 to be equal to the specified value.
Equal(value uint32) IStep
// NotEqual expects the uint32 to be not equal to the specified value.
NotEqual(value ...uint32) IStep
// OneOf expects the uint32 to be equal to one of the specified values.
OneOf(values ...uint32) IStep
// NotOneOf expects the uint32 to be not equal to one of the specified values.
NotOneOf(values ...uint32) IStep
// GreaterThan expects the uint32 to be not greater than the specified value.
GreaterThan(value uint32) IStep
// LessThan expects the uint32 to be less than the specified value.
LessThan(value uint32) IStep
// GreaterOrEqualThan expects the uint32 to be greater or equal than the specified value.
GreaterOrEqualThan(value uint32) IStep
// LessOrEqualThan expects the uint32 to be less or equal than the specified value.
LessOrEqualThan(value uint32) IStep
// Between expects the uint32 to be between the specified min and max value (inclusive, min >= uint32 >= max).
Between(min, max uint32) IStep
// NotBetween expects the uint32 to be not between the specified min and max value (inclusive, min >= uint32 >= max).
NotBetween(min, max uint32) IStep
}
IExpectUint32 provides assertions for the uint32 type.
type IExpectUint64 ¶ added in v0.5.0
type IExpectUint64 interface {
// Equal expects the uint64 to be equal to the specified value.
Equal(value uint64) IStep
// NotEqual expects the uint64 to be not equal to the specified value.
NotEqual(value ...uint64) IStep
// OneOf expects the uint64 to be equal to one of the specified values.
OneOf(values ...uint64) IStep
// NotOneOf expects the uint64 to be not equal to one of the specified values.
NotOneOf(values ...uint64) IStep
// GreaterThan expects the uint64 to be not greater than the specified value.
GreaterThan(value uint64) IStep
// LessThan expects the uint64 to be less than the specified value.
LessThan(value uint64) IStep
// GreaterOrEqualThan expects the uint64 to be greater or equal than the specified value.
GreaterOrEqualThan(value uint64) IStep
// LessOrEqualThan expects the uint64 to be less or equal than the specified value.
LessOrEqualThan(value uint64) IStep
// Between expects the uint64 to be between the specified min and max value (inclusive, min >= uint64 >= max).
Between(min, max uint64) IStep
// NotBetween expects the uint64 to be not between the specified min and max value (inclusive, min >= uint64 >= max).
NotBetween(min, max uint64) IStep
}
IExpectUint64 provides assertions for the uint64 type.
type IRequest ¶ added in v0.5.14
type IRequest interface {
// Set sets the request to the specified value.
Set(request *http.Request) IStep
// URL provides methods to set request url parameters.
URL() IRequestURL
// Host sets the request host to the specified value.
Host(name string) IStep
// Method sets the request method to the specified value.
//
// Usage:
// Request().Method(http.MethodPost)
//
// Example:
// MustDo(
// Request().Method(http.MethodPost),
// Request().URL().Scheme("https"),
// Request().URL().Host("example.com"),
// Request().URL().Path("/index.html"),
// )
Method(method string) IStep
}
IRequest provides methods to set request url parameters.
type IRequestURL ¶ added in v0.5.14
type IRequestURL interface {
// Set sets the request url to the specified value.
Set(url *urlpkg.URL) IStep
// Scheme sets the request url scheme to the specified value.
//
// Usage:
// Request().URL().Scheme("https")
//
// Example:
// MustDo(
// Request().Method(http.MethodGet),
// Request().URL().Scheme("https"),
// Request().URL().Host("example.com"),
// Request().URL().Path("/index.html"),
// )
Scheme(scheme string) IStep
// Host sets the request url host to the specified value.
//
// Usage:
// Request().URL().Host("example.com")
//
// Example:
// MustDo(
// Request().Method(http.MethodGet),
// Request().URL().Host("example.com"),
// Request().URL().Path("/index.html"),
// )
Host(host string) IStep
// Path sets the request url path to the specified value.
//
// Usage:
// Request().URL().Path("/index.html")
//
// Example:
// MustDo(
// Request().Method(http.MethodGet),
// Request().URL().Host("example.com"),
// Request().URL().Path("/index.html"),
// )
Path(path string) IStep
// RawPath sets the request url raw path to the specified value.
//
// Usage:
// Request().URL().RawPath("/index.html")
//
// Example:
// MustDo(
// Request().Method(http.MethodGet),
// Request().URL().Host("example.com"),
// Request().URL().RawPath("/index.html"),
// )
RawPath(rawPath string) IStep
// ForceQuery sets the request url force query to the specified value.
//
// Usage:
// Request().URL().ForceQuery(true)
//
// Example:
// MustDo(
// Request().Method(http.MethodGet),
// Request().URL().Host("example.com"),
// Request().URL().Path("/index.html"),
// Request().URL().ForceQuery(true),
// )
ForceQuery(forceQuery bool) IStep
// Query sets the request url query parameters.
//
// Usage:
// Request().URL().Query("page").Add(1)
//
// Example:
// MustDo(
// Request().Method(http.MethodGet),
// Request().URL().Host("example.com"),
// Request().URL().Path("/index.html"),
// Request().URL().Query("page").Add(1),
// )
Query(name string) IRequestURLQuery
// RawQuery sets the request url force query to the specified value.
//
// Usage:
// Request().URL().RawQuery("x=1&y=2")
//
// Example:
// MustDo(
// Request().Method(http.MethodGet),
// Request().URL().Host("example.com"),
// Request().URL().Path("/index.html"),
// Request().URL().RawQuery("x=1&y=2"),
// )
RawQuery(rawQuery string) IStep
// Fragment sets the request url force query to the specified value.
//
// Usage:
// Request().URL().Fragment("anchor")
//
// Example:
// MustDo(
// Request().Method(http.MethodGet),
// Request().URL().Host("example.com"),
// Request().URL().Path("/index.html"),
// Request().URL().Fragment("anchor"),
// )
Fragment(fragment string) IStep
// User sets the request url user and/or password information.
//
// Usage:
// Request().URL().User().Username("joe")
// Request().URL().User().Password("secret")
//
// Example:
// MustDo(
// Request().Method(http.MethodGet),
// Request().URL().Host("example.com"),
// Request().URL().Path("/index.html"),
// Request().URL().User().Username("joe"),
// Request().URL().User().Password("secret"),
// )
User() IRequestURLUser
}
IRequestURL provides methods to set request url parameters.
type IRequestURLQuery ¶ added in v0.5.14
type IRequestURLQuery interface {
// Add adds the specified value to the url query.
//
// Usage:
// Request().URL().Query("page").Add(1)
Add(value ...interface{}) IStep
}
IRequestURLQuery provides methods to send header/trailer.
type IRequestURLUser ¶ added in v0.5.14
type IRequestURLUser interface {
// Username sets the username for the request.
Username(name string) IStep
// Password sets the password for the request.
Password(password string) IStep
}
IRequestURLUser provides methods to set the username and/or password for the request.
type ISend ¶
type ISend interface {
// Body sets the request body to the specified value.
//
// Usage:
// Send().Body().String("Hello World")
// Send().Body().JSON("Hello World")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Send().Body().String("Hello World"),
// )
Body() ISendBody
// Headers sets the specified request header to the specified value(s).
//
// Usage:
// Send().Headers("Content-Type").Add("application/json")
// Send().Headers("Set-Cookie").Add("user=joe")
// Send().Headers("Set-Cookie").Add("id=joe")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Send().Headers("Content-Type").Add("application/json"),
// )
Headers(name string) ISendHeaders
// Trailers sets the specified request trailer to the specified value(s).
//
// Usage:
// Send().Trailers("Content-Type").Add("application/json")
//
// Example:
// MustDo(
// Get("https://example.com"),
// Send().Trailers("Content-Type").Add("application/json"),
// )
Trailers(name string) ISendHeaders
// Custom can be used to send a custom behavior.
//
// Example:
// MustDo(
// Get("https://example.com"),
// Send().Custom(func(hit Hit) error {
// hit.Request().Body().SetString("Hello World")
// return nil
// }),
// )
Custom(fn Callback) IStep
}
ISend provides methods to set request data, such as body or headers.
type ISendBody ¶
type ISendBody interface {
// Bool sets the request body to the specified bool.
//
// Usage:
// Send().Body().Bool(true)
Bool(value bool) IStep
// Bytes sets the request body to the specified byte slice.
//
// Usage:
// Send().Body().Bytes([]byte{0x48, 0x65, 0x6C, 0x6C, 0x6F})
Bytes(value []byte) IStep
// Float32 sets the request body to the specified float32.
//
// Usage:
// Send().Body().Float32(3.2)
Float32(value float32) IStep
// Float64 sets the request body to the specified float64.
//
// Usage:
// Send().Body().Float64(3.2)
Float64(value float64) IStep
// FormValues sets the request body to the specified form values.
//
// Usage:
// Send().Body().FormValues("username").Add("admin")
// Send().Body().FormValues("password").Add("secret")
FormValues(name string) ISendFormValues
// Int sets the request body to the specified int.
//
// Usage:
// Send().Body().Int(3)
Int(value int) IStep
// Int16 sets the request body to the specified int16.
//
// Usage:
// Send().Body().Int16(3)
Int16(value int16) IStep
// Int32 sets the request body to the specified int32.
//
// Usage:
// Send().Body().Int32(3)
Int32(value int32) IStep
// Int64 sets the request body to the specified int64.
//
// Usage:
// Send().Body().Int64(3)
Int64(value int64) IStep
// Int8 sets the request body to the specified int8.
//
// Usage:
// Send().Body().Int8(3)
Int8(value int8) IStep
// JSON sets the request body to the json representation of the specified value.
//
// Usage:
// Send().Body().JSON(map[string]interface{}{"Name": "Joe"})
JSON(value interface{}) IStep
// Reader sets the request body to the specified reader.
//
// Usage:
// Send().Body().Reader(bytes.NewReader([]byte{0x48, 0x65, 0x6C, 0x6C, 0x6F}))
Reader(value io.Reader) IStep
// String sets the request body to the specified string.
//
// Usage:
// Send().Body().String("Hello World")
String(value string) IStep
// Uint sets the request body to the specified uint.
//
// Usage:
// Send().Body().Uint(3)
Uint(value uint) IStep
// Uint16 sets the request body to the specified uint16.
//
// Usage:
// Send().Body().Uint16(3)
Uint16(value uint16) IStep
// Uint32 sets the request body to the specified uint32.
//
// Usage:
// Send().Body().Uint32(3)
Uint32(value uint32) IStep
// Uint64 sets the request body to the specified uint64.
//
// Usage:
// Send().Body().Uint64(3)
Uint64(value uint64) IStep
// Uint8 sets the request body to the specified uint8.
//
// Usage:
// Send().Body().Uint8(3)
Uint8(value uint8) IStep
// XML sets the request body to the XML representation of the specified value.
//
// Usage:
// Send().Body().XML([]string{"A", "B"})
XML(value interface{}) IStep
}
ISendBody provides methods to set request body.
type ISendFormValues ¶ added in v0.5.0
type ISendFormValues interface {
// Add adds the specified value to the specified form value.
//
// Usage:
// Send().Body().FormValues("username").Add("admin")
Add(value ...interface{}) IStep
}
ISendFormValues provides methods to send form values.
type ISendHeaders ¶ added in v0.5.0
type ISendHeaders interface {
// Add adds the specified value to the specified request header.
//
// Usage:
// Send().Headers("Set-Cookie").Add("foo=bar")
// Send().Headers("Set-Cookie").Add("foo=bar", "baz=taz")
Add(value ...interface{}) IStep
}
ISendHeaders provides methods to send header/trailer.
type IStep ¶
type IStep interface {
// contains filtered or unexported methods
}
IStep defines a hit step.
func BaseURL ¶
BaseURL sets the base url for each Connect, Delete, Get, Head, Post, Options, Put, Trace or Method.
Examples:
MustDo(
BaseURL("https://example.com/"),
Get("index.html"),
)
MustDo(
BaseURL("https://%s.%s/", "example", "com"),
Get("index.html"),
)
func CombineSteps ¶
CombineSteps combines multiple steps to one.
Example:
MustDo(
Get("https://example.com"),
CombineSteps(
Expect().Status().Equal(http.StatusOK),
Expect().Body().String().Equal("Hello World"),
),
)
func Context ¶ added in v0.5.5
Context sets the context for the request.
Example:
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
MustDo(
Context(ctx),
Get("https://example.com"),
Return(),
Expect().Body().String().Equal("Hello World"), // will never be executed
)
func Custom ¶
Custom can be used to run custom logic during various steps.
Example:
MustDo(
Get("https://example.com"),
Custom(ExpectStep, func(hit Hit) error {
if hit.Response().Body().MustString() != "Hello World" {
return errors.New("Expected Hello World")
}
return nil
}),
)
func Delete ¶
Delete sets the the method to DELETE and the specified url.
Examples:
MustDo(
Delete("https://example.com"),
)
MustDo(
Delete("https://%s/%s", "example.com", "index.html"),
)
func Description ¶
Description sets a custom description for this test. The description will be printed in an error case.
Example:
MustDo(
Description("Check if example.com is available"),
Get("https://example.com"),
)
func Get ¶
Get sets the the method to GET and the specified url.
Examples:
MustDo(
Get("https://example.com"),
)
MustDo(
Get("https://%s/%s", "example.com", "index.html"),
Expect().Status().Equal(http.StatusOK),
Expect().Body().String().Equal("Hello World"),
)
func HTTPClient ¶
HTTPClient sets the client for the request.
Example:
client := http.DefaultClient
MustDo(
Get("https://example.com"),
HTTPClient(client),
)
func Head ¶
Head sets the the method to HEAD and the specified url.
Examples:
MustDo(
Head("https://example.com"),
)
MustDo(
Head("https://%s/%s", "example.com", "index.html"),
)
func Method ¶
Method sets the specified method and url.
Examples:
MustDo(
Method(http.MethodGet, "https://example.com"),
)
MustDo(
Method(http.MethodGet, "https://%s/%s", "example.com", "index.html"),
)
func Options ¶
Options sets the the method to OPTIONS and the specified url.
Examples:
MustDo(
Options("https://example.com"),
)
MustDo(
Options("https://%s/%s", "example.com", "index.html"),
)
func Post ¶
Post sets the the method to POST and the specified url.
Examples:
MustDo(
Post("https://example.com"),
)
MustDo(
Post("https://%s.%s", "example", "com"),
Expect().Status().Equal(http.StatusOK),
Send().Body().String("Hello World"),
)
func Put ¶
Put sets the the method to PUT and the specified url.
Examples:
MustDo(
Put("https://example.com"),
)
MustDo(
Put("https://%s,%s", "example", "com"),
)
type IStore ¶ added in v0.5.0
type IStore interface {
// Request stores the Request.
//
// Example:
// var body string
// var userName string
// var headers http.Header
// var contentType string
// MustDo(
// Post("https://example.com/json"),
// Send().Body().JSON(map[string]interface{}{"name": "Joe"}),
// Store().Request().Body().String().In(&body), // store the body
// Store().Request().Body().JSON().JQ(".name").In(&userName), // parse body as json and store the data object into data variable
// Store().Request().Headers().In(&headers), // store all headers
// Store().Request().Headers("Content-Type").In(&contentType), // store the Content-Type header
// )
Request() IStoreRequest
// Response stores the Response.
//
// Example:
// var body string
// var userName string
// var headers http.Header
// var contentType string
// MustDo(
// Get("https://example.com/json"),
// Store().Response().Body().String().In(&body), // store the body
// Store().Response().Body().JSON().JQ(".name").In(&userName), // parse body as json and store the data object into data variable
// Store().Response().Headers().In(&headers), // store all headers
// Store().Response().Headers("Content-Type").In(&contentType), // store the Content-Type header
// )
Response() IStoreResponse
}
IStore provides a store functionality for the Request and Response.
func Store ¶ added in v0.5.0
func Store() IStore
Store stores the current Request or Response.
Examples:
var body string
MustDo(
Get("https://example.com"),
Store().Response().Body().String().In(&body),
)
var headers http.Header
MustDo(
Get("https://example.com"),
Store().Response().Headers().In(&headers),
)
var contentType string
MustDo(
Get("https://example.com"),
Store().Response().Headers("Content-Type").In(&contentType),
)
type IStoreBody ¶ added in v0.5.0
type IStoreBody interface {
// Bool treats the body contents as Bool data and stores it
//
// Usage:
// var body bool
// Store().Response().Body().Bool().In(&body)
Bool() IStoreStep
// Bytes treats the body contents as byte data and stores it
//
// Usage:
// var body []byte
// Store().Response().Body().Bytes().In(&body)
Bytes() IStoreStep
// Float32 treats the body contents as Float32 data and stores it
//
// Usage:
// var body float32
// Store().Response().Body().Float32().In(&body)
Float32() IStoreStep
// Float64 treats the body contents as Float64 data and stores it
//
// Usage:
// var body float64
// Store().Response().Body().Float64().In(&body)
Float64() IStoreStep
// FormValues treats the body contents as FormValues data and stores it
//
// Usage:
// var values url.Values
// Store().Response().Body().FormValues().In(&values)
// var username string
// Store().Response().Body().FormValues("username").In(&username)
FormValues(name ...string) IStoreStep
// Int treats the body contents as Int data and stores it
//
// Usage:
// var body int
// Store().Response().Body().Int().In(&body)
Int() IStoreStep
// Int8 treats the body contents as Int8 data and stores it
//
// Usage:
// var body int8
// Store().Response().Body().Int8().In(&body)
Int8() IStoreStep
// Int16 treats the body contents as Int16 data and stores it
//
// Usage:
// var body int16
// Store().Response().Body().Int16().In(&body)
Int16() IStoreStep
// Int32 treats the body contents as Int32 data and stores it
//
// Usage:
// var body int32
// Store().Response().Body().Int32().In(&body)
Int32() IStoreStep
// Int64 treats the body contents as Int64 data and stores it
//
// Usage:
// var body int64
// Store().Response().Body().Int64().In(&body)
Int64() IStoreStep
// JSON treats the body as JSON data and stores it
//
// Example:
// // given the following body: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// var body map[string]interface{}
// var name string
// MustDo(
// Get("https://example.com/json"),
// Store().Response().Body().JSON().In(&body), // store the whole body as a map
// Store().Response().Body().JSON().JQ(".Name").In(&name), // store "Joe" in name
// )
JSON() IStoreBodyJSON
// String treats the body contents as String data and stores it
//
// Usage:
// var body string
// Store().Response().Body().String().In(&body)
String() IStoreStep
// Uint treats the body contents as Uint data and stores it
//
// Usage:
// var body uint
// Store().Response().Body().Uint().In(&body)
Uint() IStoreStep
// Uint8 treats the body contents as Uint8 data and stores it
//
// Usage:
// var body uint8
// Store().Response().Body().Uint8().In(&body)
Uint8() IStoreStep
// Uint16 treats the body contents as Uint16 data and stores it
//
// Usage:
// var body uint16
// Store().Response().Body().Uint16().In(&body)
Uint16() IStoreStep
// Uint32 treats the body contents as Uint32 data and stores it
//
// Usage:
// var body uint32
// Store().Response().Body().Uint32().In(&body)
Uint32() IStoreStep
// Uint64 treats the body contents as Uint64 data and stores it
//
// Usage:
// var body uint64
// Store().Response().Body().Uint64().In(&body)
Uint64() IStoreStep
}
IStoreBody defines the functions that can be used to store data from the http request/response body.
type IStoreBodyJSON ¶ added in v0.5.0
type IStoreBodyJSON interface {
IStoreStep
// JQ runs an jq expression on the JSON body the result can than be stored afterwards
//
// Example:
// // given the following body: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// var name string
// MustDo(
// Get("https://example.com/json"),
// Store().Response().Body().JSON().JQ(".Name").In(&name), // store "Joe" in name
// )
JQ(expression ...string) IStoreStep
}
IStoreBodyJSON defines the functions that can be used to store data from the http request/response body (in JSON format).
type IStoreRequest ¶ added in v0.5.0
type IStoreRequest interface {
// Method stores the Request's Method
Method() IStoreStep
// URL stores the Request's URL
//
// The argument can be used to narrow down the store path
//
// Usage:
// var u url.URL
// Store().Request().URL().In(&u)
// var path string
// Store().Request().URL().Path().In(&path)
URL() IStoreURL
// Proto stores the Request's Proto
Proto() IStoreStep
// ProtoMajor stores the Request's ProtoMajor
ProtoMajor() IStoreStep
// ProtoMinor stores the Request's ProtoMinor
ProtoMinor() IStoreStep
// ContentLength stores the Request's ContentLength
ContentLength() IStoreStep
// TransferEncoding stores the Request's TransferEncoding
//
// The argument can be used to narrow down the store path
TransferEncoding() IStoreStep
// Host stores the Request's Host
Host() IStoreStep
// Headers stores the Request's Headers(s)
//
// If you specify the argument you can directly store the header value
//
// Usage:
// var headers http.Header
// Store().Request().Headers().In(&headers)
// var contentType string
// Store().Request().Headers("Content-Type").In(&contentType)
Headers(headerName ...string) IStoreStep
// Trailers stores the Request's Trailers(s)
//
// If you specify the argument you can directly store the trailer value
//
// Usage:
// var trailers http.Header
// Store().Request().Trailers().In(&trailers)
// var contentType string
// Store().Request().Trailers("Content-Type").In(&contentType)
Trailers(trailerName ...string) IStoreStep
// Body stores the Request's Body
//
// given the following body: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// Usage:
// var body string
// Store().Request().Body().String().In(&body) // store the whole body as string
// var name string
// Store().Request().Body().JSON().JQ(".Name").In(&name) // store "Joe" in name
Body() IStoreBody
}
IStoreRequest defines the functions that can be used to store data from the http request.
type IStoreResponse ¶ added in v0.5.0
type IStoreResponse interface {
// Status stores the Response's Status
Status() IStoreStep
// Status stores the Response's StatusCode
StatusCode() IStoreStep
// Proto stores the Response's Proto
Proto() IStoreStep
// ProtoMajor stores the Response's ProtoMajor
ProtoMajor() IStoreStep
// ProtoMinor stores the Response's ProtoMinor
ProtoMinor() IStoreStep
// ContentLength stores the Response's ContentLength
ContentLength() IStoreStep
// TransferEncoding stores the Response's TransferEncoding
//
// The argument can be used to narrow down the store path
TransferEncoding() IStoreStep
// Header stores the Response's Header(s)
//
// If you specify the argument you can directly store the header value
//
// Usage:
// var headers http.Header
// Store().Response().Headers().In(&headers)
//
// var contentType string
// Store().Response().Headers("Content-Type").In(&contentType)
Headers(headerName ...string) IStoreStep
// Trailer stores the Response's Trailer(s)
//
// If you specify the argument you can directly store the trailer value
//
// Usage:
// var trailers http.Header
// Store().Response().Trailers().In(&trailers)
//
// var contentType string
// Store().Response().Trailers("Content-Type").In(&contentType)
Trailers(trailerName ...string) IStoreStep
// Body stores the Response's Body
//
// given the following body: { "ID": 10, "Name": "Joe", "Roles": ["Admin", "User"] }
// Usage:
// var body string
// Store().Response().Body().String().In(&body) // store the whole body as string
// var name string
// Store().Response().Body().JSON().JQ(".Name").In(&name) // store "Joe" in name
Body() IStoreBody
// Uncompressed stores the Response's Uncompressed status
Uncompressed() IStoreStep
}
IStoreResponse defines the functions that can be used to store data from the http response.
type IStoreStep ¶ added in v0.5.0
type IStoreStep interface {
// In can be used to to store the result into an existing variable
//
// Example:
// var body string
// MustDo(
// Get("https://example.com"),
// Store().Response().Body().String().In(&body),
// )
In(interface{}) IStep
}
IStoreStep defines the In function for the Store() functionality.
type IStoreURL ¶ added in v0.5.0
type IStoreURL interface {
IStoreStep
// Scheme stores the URLs scheme
Scheme() IStoreStep
// Scheme stores the URLs opaque status
Opaque() IStoreStep
// Scheme stores the URLs UserInfo
User() IStoreUserInfo
// Host stores the URLs host
Host() IStoreStep
// Hostname stores the URLs host, stripping any valid port number if present.
//
// If the result is enclosed in square brackets, as literal IPv6 addresses are,
// the square brackets are removed from the result.
Hostname() IStoreStep
// Port stores the port part of the URLs host, without the leading colon.
//
// If URLs Host doesn't contain a valid numeric port, Port stores an empty string.
Port() IStoreStep
// Path stores the URLs path.
Path() IStoreStep
// EscapedPath stores the URLs path.
EscapedPath() IStoreStep
// RawPath stores the URLs RawPath value.
RawPath() IStoreStep
// Query stores the URLs Query value.
//
// Usage:
// var values url.Values
// Store().Request().URL().Query().In(&values)
// var user string
// Store().Request().URL().Query("user").In(&user)
Query(name ...string) IStoreStep
// ForceQuery stores the URLs ForceQuery value.
ForceQuery() IStoreStep
// RawQuery stores the URLs RawQuery value.
RawQuery() IStoreStep
// Fragment stores the URLs Fragment value.
Fragment() IStoreStep
// IsAbs stores URLs IsAbs value.
IsAbs() IStoreStep
// RequestURI stores the URLs RequestURI value.
RequestURI() IStoreStep
// String stores the URLs String value.
String() IStoreStep
}
IStoreURL defines the functions that can be used to store a URL part.
type IStoreUserInfo ¶ added in v0.5.0
type IStoreUserInfo interface {
IStoreStep
// Username stores the UserInfo's username
Username() IStoreStep
// Password stores the UserInfo's password
Password() IStoreStep
// String stores the string representation of UserInfo
String() IStoreStep
}
IStoreUserInfo defines the functions that can be used to store a user part.
type StepTime ¶
type StepTime uint8
StepTime defines when a step should be run.
const ( // BeforeSendStep runs before the Send() steps. BeforeSendStep StepTime // SendStep runs during the Send() steps. SendStep // AfterSendStep runs after the Send() steps, note that this is still before the actual sending process. AfterSendStep // BeforeExpectStep runs before the Expect() steps (this is after we got the data from the server). BeforeExpectStep // ExpectStep runs during the Expect() steps. ExpectStep // AfterExpectStep runs after the Expect() steps. AfterExpectStep )
Source Files
¶
- clear.go
- clear_expect_body_gen.go
- clear_expect_body_json_gen.go
- clear_expect_body_jsonjq_gen.go
- clear_expect_bytes_gen.go
- clear_expect_float32_gen.go
- clear_expect_float64_gen.go
- clear_expect_form_values_gen.go
- clear_expect_gen.go
- clear_expect_header_value_gen.go
- clear_expect_headers_gen.go
- clear_expect_int16_gen.go
- clear_expect_int32_gen.go
- clear_expect_int64_gen.go
- clear_expect_int8_gen.go
- clear_expect_int_gen.go
- clear_expect_string_gen.go
- clear_expect_uint16_gen.go
- clear_expect_uint32_gen.go
- clear_expect_uint64_gen.go
- clear_expect_uint8_gen.go
- clear_expect_uint_gen.go
- clear_send_body_gen.go
- clear_send_form_values_gen.go
- clear_send_gen.go
- clear_send_headers_gen.go
- clearpath.go
- debug.go
- debug_body.go
- debug_body_json.go
- debug_header.go
- debug_request.go
- debug_response.go
- errors.go
- expect.go
- expect_body.go
- expect_body_json.go
- expect_body_json_jq.go
- expect_bytes.go
- expect_float32_gen.go
- expect_float64_gen.go
- expect_formvalues.go
- expect_header.go
- expect_header_value.go
- expect_int16_gen.go
- expect_int32_gen.go
- expect_int64_gen.go
- expect_int8_gen.go
- expect_int_gen.go
- expect_string.go
- expect_uint16_gen.go
- expect_uint32_gen.go
- expect_uint64_gen.go
- expect_uint8_gen.go
- expect_uint_gen.go
- hit.go
- http_request.go
- http_response.go
- localhelpers.go
- request.go
- request_url.go
- request_url_query.go
- request_url_user.go
- send.go
- send_body.go
- send_formvalues.go
- send_header.go
- static.go
- step.go
- store.go
- store_body.go
- store_body_json.go
- store_request.go
- store_response.go
- store_url.go
- store_userinfo.go
- testingT.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package doctest is a package to help test the hit framework.
|
Package doctest is a package to help test the hit framework. |
|
implicit
Package implicit can be used for testing purposes.
|
Package implicit can be used for testing purposes. |
|
server
Package server provides a test server that can be used as a test environment for the hit package.
|
Package server provides a test server that can be used as a test environment for the hit package. |
|
Package errortrace provides a method to track function stacktrace and populate it in case of error.
|
Package errortrace provides a method to track function stacktrace and populate it in case of error. |
|
generators
|
|
|
clear/clear
command
|
|
|
clear/tests
command
|
|
|
doc
command
|
|
|
expect/numeric
command
|
|
|
helpers
Package helpers contains some helper functions for the generators.
|
Package helpers contains some helper functions for the generators. |
|
readme
command
|
|
|
Package httpbody contains a http body representation with a reusable body that can be consumed multiple times.
|
Package httpbody contains a http body representation with a reusable body that can be consumed multiple times. |
|
internal
|
|
|
converter
Package converter contains a convert.Converter for the hit package with some standard recipes.
|
Package converter contains a convert.Converter for the hit package with some standard recipes. |
|
minitest
Package minitest provides some testing functions for the hit package.
|
Package minitest provides some testing functions for the hit package. |
|
minitest/contains
Package contains provides functions to check if a needle is in an haystack.
|
Package contains provides functions to check if a needle is in an haystack. |
|
misc
Package misc provides some helper functions that are used in hit.
|
Package misc provides some helper functions that are used in hit. |