helpers

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: AGPL-3.0, Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRequest

func CreateRequest[T any](method string, endpoint string, body T) func(requestServer *httptest.Server, externalServer *httptest.Server) ([]byte, error)

func CreateRequestWithResponse added in v1.2.0

func CreateRequestWithResponse[T any](method string, endpoint string, body T) func(requestServer *httptest.Server, externalServer *httptest.Server) ([]byte, *http.Response, error)

func MockResponse

func MockResponse(endpoint string, response []byte, err error, status int) func(handlers map[string]http.HandlerFunc) error

func SetupProviderServer

func SetupProviderServer(handlers map[string]http.HandlerFunc) (*httptest.Server, error)

func SetupServer

func SetupServer() (*httptest.Server, error)

Types

type TestStruct

type TestStruct[Request any, Response any] struct {
	Name       string
	Method     string
	Endpoint   string
	Request    Request
	WantData   Response
	WantErr    error
	WantStatus int
}

Jump to

Keyboard shortcuts

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