fsttest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0, BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResponseRecorder

type ResponseRecorder struct {
	Code      int
	HeaderMap fsthttp.Header
	Body      *bytes.Buffer
}

ResponseRecorder is an implementation of fsthttp.ResponseWriter that records its mutations for later inspection in tests.

func NewRecorder

func NewRecorder() *ResponseRecorder

NewRecorder returns an initialized ResponseRecorder.

func (*ResponseRecorder) Append

func (r *ResponseRecorder) Append(other io.ReadCloser) error

Append records the response body. The data is written to the Body field of the ResponseRecorder.

func (*ResponseRecorder) Close

func (r *ResponseRecorder) Close() error

Close is a no-op on ResponseRecorder. It exists to satisfy the fsthttp.ResponseWriter interface.

func (*ResponseRecorder) Header

func (r *ResponseRecorder) Header() fsthttp.Header

Header returns the response headers to mutate within a handler.

func (*ResponseRecorder) SetManualFramingMode

func (r *ResponseRecorder) SetManualFramingMode(v bool)

SetManualFramingMode is a no-op on ResponseRecorder. It exists to satisfy the fsthttp.ResponseWriter interface.

func (*ResponseRecorder) Write

func (r *ResponseRecorder) Write(b []byte) (int, error)

Write records the response body. The data is written to the Body field of the ResponseRecorder.

func (*ResponseRecorder) WriteHeader

func (r *ResponseRecorder) WriteHeader(code int)

WriteHeader records the response code.

Jump to

Keyboard shortcuts

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