mocks

package
v1.36.4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockReader

type MockReader struct{}

func NewMockReader

func NewMockReader() *MockReader

func (*MockReader) Read

func (r *MockReader) Read([]byte) (int, error)

type MockResponseWriter

type MockResponseWriter struct {
	HeaderMap  http.Header
	StatusCode int
	Body       bytes.Buffer

	WriteErr bool // Force Write() calls to error.
}

MockResponseWriter is a custom mock implementation of http.ResponseWriter.

func NewMockResponseWriter

func NewMockResponseWriter() *MockResponseWriter

NewMockResponseWriter creates a new instance of MockResponseWriter.

func (*MockResponseWriter) Header

func (rw *MockResponseWriter) Header() http.Header

Header returns the mock headers.

func (*MockResponseWriter) Write

func (rw *MockResponseWriter) Write(p []byte) (int, error)

Write mocks the Write method, which writes the response body.

func (*MockResponseWriter) WriteHeader

func (rw *MockResponseWriter) WriteHeader(statusCode int)

WriteHeader mocks the WriteHeader method, which sets the HTTP status code.

Jump to

Keyboard shortcuts

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