Help us shape the future of Go! Take the 2026 Go Developer Survey

requesttermination

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init added in v0.9.0

func Init() error

Init registers the request_termination middleware.

Types

type Middleware added in v0.10.0

type Middleware struct {
	// contains filtered or unexported fields
}

Middleware is a middleware that terminates the request with a specified status code and body.

func NewMiddleware

func NewMiddleware(options Options) *Middleware

NewMiddleware creates a new RequestTerminationMiddleware instance.

func (*Middleware) ServeHTTP added in v0.10.0

func (m *Middleware) ServeHTTP(_ context.Context, c *app.RequestContext)

type Options

type Options struct {
	ContentType string `mapstructure:"content_type"`
	Body        string `mapstructure:"body"`
	StatusCode  int    `mapstructure:"status_code"`
}

Options defines the configuration for the request termination middleware.

Jump to

Keyboard shortcuts

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