package
0.0.0-20140208234550-8ce6181c2609
Repository: https://github.com/codegangsta/martini-contrib.git
Documentation: pkg.go.dev

# README

method

Martini middleware/handler for handling http method overrides. This checks for the X-HTTP-Method-Override header and uses it if the original request method is POST. GET/HEAD methods shouldn't be overriden, hence they can't be overriden.

This is useful for REST APIs and services making use of many HTTP verbs, and when http clients don't support all of them.

API Reference

Usage

import (
  "github.com/codegangsta/martini"
  "github.com/codegangsta/martini-contrib/method"
)

func main() {
  m := martini.Classic()
  m.Use(method.Override())
  m.Run()
}

Authors

# Functions

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.
OverrideRequestMethod overrides the http request's method with the specified method.

# Constants

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

# Variables

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