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

methodoverride

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Method override headers expose the requested and original methods.
	HeaderXHTTPMethodOverride = "X-HTTP-Method-Override"
	HeaderXOriginalMethod     = "X-Original-Method"
)

Variables

This section is empty.

Functions

func New

func New(configs ...Config) zinc.Middleware

New lets POST requests ask for PUT, PATCH, or DELETE. It rewrites only explicitly permitted source methods, so header input cannot widen route access.

Types

type Config

type Config struct {
	Getter        Getter
	SourceMethods []string
	Methods       []string
}

Config limits both source and destination methods.

type Getter

type Getter func(*zinc.Context) string

Getter reads a requested replacement method.

func FromFirst

func FromFirst(getters ...Getter) Getter

func FromHeader

func FromHeader(header string) Getter

func FromQuery

func FromQuery(name string) Getter

Jump to

Keyboard shortcuts

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