writer

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchRoutePathTemplate

func FetchRoutePathTemplate(r *http.Request) string

FetchRoutePathTemplate extracts the path template from a given request, or emptry string if none could be found.

func StatusRecorderMiddleware added in v0.13.0

func StatusRecorderMiddleware(next http.Handler) http.Handler

StatusRecorderMiddleware wraps the http.ResponseWriter with StatusRecorder so that downstream middlewares can utilize the outcome status code after the response completes. This middleware should be attached as early as possible.

Types

type StatusRecorder

type StatusRecorder struct {
	http.ResponseWriter
	StatusCode int
}

StatusRecorder wraps the http ResponseWriter, allowing additional instrumentation and metrics capture before the response is returned to the client.

func (*StatusRecorder) WriteHeader

func (sr *StatusRecorder) WriteHeader(code int)

WriteHeader implements the http ResponseWriter WriteHeader interface. This function acts as a middleware which captures the StatusCode on the StatusRecorder and then delegates the actual work of writing the header to the underlying http ResponseWriter.

Jump to

Keyboard shortcuts

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