middleware

package
v0.15.21 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(ctx context.Context, next http.Handler) http.Handler

Logger - middleware that logs requests

Types

type HTTPError

type HTTPError struct {
	Code int
	// contains filtered or unexported fields
}

HTTPError records an HTTP error and the request that caused it

func NewHTTPError

func NewHTTPError(err error, r *http.Request, code ...int) *HTTPError

NewHTTPError - wrap an error as an HTTP error

func (*HTTPError) Error

func (e *HTTPError) Error() string

func (*HTTPError) Request

func (e *HTTPError) Request() *http.Request

Request - return the request that caused this error

func (*HTTPError) Send

Send - respond with this error, and return it for further use

func (*HTTPError) Unwrap

func (e *HTTPError) Unwrap() error

Jump to

Keyboard shortcuts

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