testutil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestResponseWriter

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

TestResponseWriter is a mock implementation of http.ResponseWriter for testing

func NewTestContext

func NewTestContext(method, url string) (*http.Request, *TestResponseWriter)

NewTestContext creates a new test request and response writer for testing

func (*TestResponseWriter) Body

func (w *TestResponseWriter) Body() []byte

Body returns the response body

func (*TestResponseWriter) Header

func (w *TestResponseWriter) Header() http.Header

Header returns the header map for the mock response writer

func (*TestResponseWriter) StatusCode

func (w *TestResponseWriter) StatusCode() int

StatusCode returns the status code that was set

func (*TestResponseWriter) Write

func (w *TestResponseWriter) Write(data []byte) (int, error)

Write writes data to the mock response body

func (*TestResponseWriter) WriteHeader

func (w *TestResponseWriter) WriteHeader(statusCode int)

WriteHeader sets the status code for the mock response

Jump to

Keyboard shortcuts

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