httptest

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package httptest wraps the standard library's httptest.ResponseRecorder in order to fail any test doing superfluous response.WriteHeader calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WrappedResponseRecorder

type WrappedResponseRecorder struct {
	*stdhttptest.ResponseRecorder
	// contains filtered or unexported fields
}

WrappedResponseRecorder wraps httptest.ResponseRecorder in order to fail tests doing superfluous WriteHeader calls.

func NewRecorder

func NewRecorder() *WrappedResponseRecorder

NewRecorder returns a new test response recorder detecting superfluous WriteHeader calls.

func (*WrappedResponseRecorder) WriteHeader

func (w *WrappedResponseRecorder) WriteHeader(code int)

WriteHeader implements http.ResponseWriter, failing tests that do superfluous WriteHeader calls.

Jump to

Keyboard shortcuts

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