method: Index | Files

package method

import ""

package method implements http method override using the X-HTTP-Method-Override http header.


Package Files



const HeaderHTTPMethodOverride = "X-HTTP-Method-Override"

HeaderHTTPMethodOverride is a commonly used Http header to override the method.

const ParamHTTPMethodOverride = "_method"

ParamHTTPMethodOverride is a commonly used HTML form parameter to override the method.


var ErrInvalidOverrideMethod = errors.New("invalid override method")

ErrInvalidOverrideMethod is returned when an invalid http method was given to OverrideRequestMethod.

func Override Uses

func Override() http.Handler

Override checks for the X-HTTP-Method-Override header or the HTML for parameter, `_method` and uses (if valid) the http method instead of Request.Method. This is especially useful for http clients that don't support many http verbs. It isn't secure to override e.g a GET to a POST, so only Request.Method which are POSTs are considered.

func OverrideRequestMethod Uses

func OverrideRequestMethod(r *http.Request, method string) error

OverrideRequestMethod overrides the http request's method with the specified method.

Package method imports 2 packages (graph) and is imported by 3 packages. Updated 2016-07-14. Refresh now. Tools for package owners.