fakehttp

package
v2.9.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2018 License: CC0-1.0 Imports: 1 Imported by: 0

Documentation

Overview

Package fakehttp provides a fake response writer for use in tests. Further http package mocks will probably not be created, as I'm sure there's a more complete http mock library out there.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResponseWriter

type ResponseWriter struct {
	StatusCode int
	Headers    http.Header
	Output     []byte
}

The ResponseWriter adheres to the http.ResposeWriter interface in a minimal way to support easier testing

func NewResponseWriter

func NewResponseWriter() *ResponseWriter

NewResponseWriter returns a ResponseWriter with a default status code of -1

func (*ResponseWriter) Header

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

Header returns the http.Header data for http.ResponseWriter compatibility

func (*ResponseWriter) Write

func (rw *ResponseWriter) Write(b []byte) (int, error)

Write stores the given output for later testing

func (*ResponseWriter) WriteHeader

func (rw *ResponseWriter) WriteHeader(s int)

WriteHeader sets up StatusCode for later testing

Jump to

Keyboard shortcuts

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