middleware

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 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 WrappedResponseWriter

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

WrappedResponseWriter wraps a standard http.ResponseWriter so we can store the status code, track size and duration of response.

func NewWrappedResponseWriter

func NewWrappedResponseWriter(res http.ResponseWriter) *WrappedResponseWriter

NewWrappedResponseWriter creates a new wrapped response writer

func (*WrappedResponseWriter) Body

func (w *WrappedResponseWriter) Body() []byte

Body flattens the chunks of byte arrays into a single byte array

func (*WrappedResponseWriter) DurationMS

func (w *WrappedResponseWriter) DurationMS() int

DurationMS returns the duration of this response in milliseconds

func (*WrappedResponseWriter) Header

func (w *WrappedResponseWriter) Header() http.Header

Header passes through to the response writer

func (*WrappedResponseWriter) ShouldReportOnAirbrake

func (w *WrappedResponseWriter) ShouldReportOnAirbrake() bool

ShouldReportOnAirbrake returns true if response code is 5xx

func (*WrappedResponseWriter) Size

func (w *WrappedResponseWriter) Size() int

Size returns the total bytes written

func (*WrappedResponseWriter) Status

func (w *WrappedResponseWriter) Status() int

Status returns the captured status code

Jump to

Keyboard shortcuts

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