middlewares

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package middlewares contains common middlewares helpers.

Index

Constants

This section is empty.

Variables

View Source
var Identity = Func(func(next http.Handler) http.Handler {
	return next
})

Identity is a middleware that does nothing.

Functions

func ResponseError

func ResponseError(w http.ResponseWriter, code int, err *openapi.Error)

ResponseError writes an error response to w.

Types

type Func

type Func func(next http.Handler) http.Handler

Func is an adapter to allow the use of ordinary functions as middleware.

func (Func) Handler

func (fn Func) Handler(next http.Handler) http.Handler

Handler implements the Middleware interface.

type Middleware

type Middleware interface {
	Handler(next http.Handler) http.Handler
}

A Middleware https://cs.opensource.google/go/x/pkgsite/+/68be0dd1:internal/middleware/middleware.go

func Chain added in v0.6.0

func Chain(ms ...Middleware) Middleware

Chain middlewares into one middleware.

Directories

Path Synopsis
Package apidoc contains a middleware to serve the OpenAPI document.
Package apidoc contains a middleware to serve the OpenAPI document.
Package calm implements a middleware to recover from panic.
Package calm implements a middleware to recover from panic.

Jump to

Keyboard shortcuts

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