Browse Source

HTTP method names are case sensitive

Who knew! (RFC 2616, 5.1.1)
Carl Jackson 12 years ago
parent
commit
386323a6ed
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      web/middleware/options.go
  2. +1
    -1
      web/router.go

+ 1
- 1
web/middleware/options.go View File

@ -18,7 +18,7 @@ func AutomaticOptions(c *web.C, h http.Handler) http.Handler {
// 404 route anyways. // 404 route anyways.
var fw *httptest.ResponseRecorder var fw *httptest.ResponseRecorder
pw := w pw := w
if strings.ToUpper(r.Method) == "OPTIONS" {
if r.Method == "OPTIONS" {
fw = httptest.NewRecorder() fw = httptest.NewRecorder()
pw = fw pw = fw
} }


+ 1
- 1
web/router.go View File

@ -129,7 +129,7 @@ func parseHandler(h interface{}) Handler {
} }
func httpMethod(mname string) method { func httpMethod(mname string) method {
if method, ok := validMethodsMap[strings.ToUpper(mname)]; ok {
if method, ok := validMethodsMap[mname]; ok {
return method return method
} }
return mIDK return mIDK


Loading…
Cancel
Save