httpunit

package module
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 12 Imported by: 0

README

Build Status Code Coverage Go Report Card GoDoc

httpunit

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DumpHandler

type DumpHandler struct {
	// contains filtered or unexported fields
}

func NewDumpHandler

func NewDumpHandler(t T, inner http.Handler) *DumpHandler

func (*DumpHandler) ServeHTTP

func (this *DumpHandler) ServeHTTP(response http.ResponseWriter, request *http.Request)

func (*DumpHandler) Teardown

func (this *DumpHandler) Teardown()

type HTTPFixture

type HTTPFixture struct {
	DumpHandler      *DumpHandler
	RequestBuilder   *RequestBuilder
	ResponseRecorder *httptest.ResponseRecorder
	// contains filtered or unexported fields
}

func NewFixture

func NewFixture(t T, inner http.Handler) *HTTPFixture

func (*HTTPFixture) AssertJSONResponse

func (this *HTTPFixture) AssertJSONResponse(expectedStatus int, expectedBody interface{})

func (*HTTPFixture) AssertResponseStatusCode

func (this *HTTPFixture) AssertResponseStatusCode(expected int)

func (*HTTPFixture) DeserializeJSONResponseBody

func (this *HTTPFixture) DeserializeJSONResponseBody(v interface{})

func (*HTTPFixture) Serve

func (this *HTTPFixture) Serve()

func (*HTTPFixture) Teardown

func (this *HTTPFixture) Teardown()

type RequestBuilder

type RequestBuilder struct {
	Context context.Context
	Method  string
	URL     string
	Headers http.Header
	Body    string
	JSON    interface{}
}

func NewRequestBuilder

func NewRequestBuilder() *RequestBuilder

func (*RequestBuilder) Build

func (this *RequestBuilder) Build() *http.Request

type T

type T interface {
	Helper()
	Failed() bool
	Log(args ...interface{})
	Errorf(format string, args ...interface{})
}

Jump to

Keyboard shortcuts

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