xhttptest

package
v0.0.2-rc-ci Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunHttpTests

func RunHttpTests(t *testing.T, testServer *httptest.Server, tests []HttpTest)

RunHttpTests runs a set of http tests on the given test server.

func TestMiddleware

func TestMiddleware(t *testing.T, middleware func(next http.Handler) http.Handler, tests []HttpTest)

func TestRouter

func TestRouter(t *testing.T, router func(r chi.Router), tests []HttpTest)

TestRouter tests a chi Router with a set of http tests.

Types

type HttpTest

type HttpTest struct {
	Name        string
	PreTest     func() error
	URI         string
	Method      string
	Headers     map[string]string
	Body        string
	WantStatus  int
	WantBody    string
	WantHeaders map[string]string
}

HttpTest defines an http test case.

Jump to

Keyboard shortcuts

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