Documentation
¶
Overview ¶
Package chttptest provides utility functions that are useful when testing chttp
Index ¶
Constants ¶
View Source
const ContentTypeApplicationJSON = "application/json"
ContentTypeApplicationJSON defines the application/json content type that can be used when making HTTP requests.
Variables ¶
This section is empty.
Functions ¶
func NewReaderWriter ¶
func NewReaderWriter(t *testing.T) *chttp.ReaderWriter
NewReaderWriter creates a *chttp.ReaderWriter suitable for use in tests
func PingRoutes ¶
PingRoutes creates a handler using chttp.NewHandler, starts a test http server, and calls each provided route. It verifies that each route's handler is called successfully.
Types ¶
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware is a simple implementation of chttp.Middleware useful for testing that simply runs the provided func.
func NewMiddleware ¶
func NewMiddleware(fn func(next http.Handler) http.Handler) *Middleware
NewMiddleware returns an implementation of chttp.Middleware that runs the provided func.
Click to show internal directories.
Click to hide internal directories.