Method Override
Method Override middleware reads the overridden method from the request and uses it instead of the original method.
All core middleware lives in the middleware package:
import "github.com/labstack/echo/v5/middleware"e.Pre(middleware.MethodOverride())Custom configuration
Section titled “Custom configuration”e := echo.New()e.Pre(middleware.MethodOverrideWithConfig(middleware.MethodOverrideConfig{ Getter: middleware.MethodFromForm("_method"),}))The method can be sourced with MethodFromHeader, MethodFromForm, or MethodFromQuery.
Configuration
Section titled “Configuration”type MethodOverrideConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper
// Getter is a function that gets the overridden method from the request. // Optional. Default value MethodFromHeader(echo.HeaderXHTTPMethodOverride). Getter MethodOverrideGetter}Default configuration
Section titled “Default configuration”DefaultMethodOverrideConfig = MethodOverrideConfig{ Skipper: DefaultSkipper, Getter: MethodFromHeader(echo.HeaderXHTTPMethodOverride),}