httputil

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomResponseWriter

type CustomResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

CustomResponseWriter implements http.ResponseWriter and extends the default implementation by allowing us access to the http response code

func NewCustomResponseWriter

func NewCustomResponseWriter(resp http.ResponseWriter, catchBody bool) *CustomResponseWriter

NewCustomResponseWriter returns a CustomResponseWriter from the supplied http.ResponseWriter

func (*CustomResponseWriter) Body

func (resp *CustomResponseWriter) Body() []byte

Body returns the HTTP body (if `catchBody == true` in the constructor)

func (*CustomResponseWriter) Status

func (resp *CustomResponseWriter) Status() int

Status returns the HTTP status code (or 0 if not set)

func (*CustomResponseWriter) Write

func (resp *CustomResponseWriter) Write(in []byte) (int, error)

Write implements http.ResponseWriter

func (*CustomResponseWriter) WriteHeader

func (resp *CustomResponseWriter) WriteHeader(code int)

WriteHeader implements http.ResponseWriter

Jump to

Keyboard shortcuts

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