httptest

package
v0.0.0-...-3d9cc79 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Testing related to the http package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowedMethodsShouldBe

func AllowedMethodsShouldBe(response fmt.Stringer, methods ...string) func()

func ShouldAllowMethods

func ShouldAllowMethods(response fmt.Stringer, methods ...string) func()

func ShouldHaveNoBody

func ShouldHaveNoBody(response fmt.Stringer, status int, reason string) func()

func ShouldNotAllowMethod

func ShouldNotAllowMethod(response fmt.Stringer, method string) func()

Types

type RequestMessage

type RequestMessage struct {
	MethodReturns  string
	PathReturns    string
	TargetReturns  string
	VersionReturns string

	MakeResourceRequestReturns http.Request
	// contains filtered or unexported fields
}

func (*RequestMessage) AddHeader

func (message *RequestMessage) AddHeader(field string, value string)

func (*RequestMessage) AddQueryParameter

func (message *RequestMessage) AddQueryParameter(name string, value string)

func (*RequestMessage) Body

func (message *RequestMessage) Body() []byte

func (*RequestMessage) HeaderLines

func (message *RequestMessage) HeaderLines() []string

func (*RequestMessage) HeaderValues

func (message *RequestMessage) HeaderValues(field string) (values []string)

func (*RequestMessage) MakeResourceRequest

func (message *RequestMessage) MakeResourceRequest(resource http.Resource) http.Request

func (*RequestMessage) MakeResourceRequestShouldHaveReceived

func (message *RequestMessage) MakeResourceRequestShouldHaveReceived(resource http.Resource)

func (*RequestMessage) Method

func (message *RequestMessage) Method() string

func (*RequestMessage) Path

func (message *RequestMessage) Path() string

func (*RequestMessage) QueryParameters

func (message *RequestMessage) QueryParameters() []http.QueryParameter

func (*RequestMessage) SetStringBody

func (message *RequestMessage) SetStringBody(body string)

func (*RequestMessage) Target

func (message *RequestMessage) Target() string

func (*RequestMessage) Version

func (message *RequestMessage) Version() string

type RequestMock

type RequestMock struct {
	HandleReturns string
	// contains filtered or unexported fields
}

func (*RequestMock) Handle

func (mock *RequestMock) Handle(writer io.Writer) error

func (*RequestMock) VerifyHandle

func (mock *RequestMock) VerifyHandle(writer *bufio.Writer)

type ResponseMessage

type ResponseMessage struct {
	Text string
}

func ParseResponse

func ParseResponse(text fmt.Stringer) *ResponseMessage

func (*ResponseMessage) BodyShould

func (message *ResponseMessage) BodyShould(matcher types.GomegaMatcher)

func (ResponseMessage) HeaderAsInt

func (message ResponseMessage) HeaderAsInt(name string) (int, error)

func (*ResponseMessage) HeaderShould

func (message *ResponseMessage) HeaderShould(name string, match types.GomegaMatcher)

func (*ResponseMessage) HeaderShouldNot

func (message *ResponseMessage) HeaderShouldNot(name string, doNotMatch types.GomegaMatcher)

func (*ResponseMessage) HeaderValue

func (message *ResponseMessage) HeaderValue(name string) string

func (*ResponseMessage) ShouldBeWellFormed

func (message *ResponseMessage) ShouldBeWellFormed()

func (*ResponseMessage) StatusShouldBe

func (message *ResponseMessage) StatusShouldBe(status int, reason string)

Jump to

Keyboard shortcuts

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