Browse Source

Automatic HEAD support for GET handlers

Carl Jackson 12 years ago
parent
commit
836cb84fdc
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      web/router.go

+ 6
- 1
web/router.go View File

@ -223,8 +223,13 @@ func (m *router) Delete(pattern interface{}, handler interface{}) {
// Dispatch to the given handler when the pattern matches and the HTTP method is
// GET. See the documentation for type Mux for a description of what types are
// accepted for pattern and handler.
//
// All GET handlers also transparently serve HEAD requests, since net/http will
// take care of all the fiddly bits for you. If you wish to provide an alternate
// implementation of HEAD, you should add a handler explicitly and place it
// above your GET handler.
func (m *router) Get(pattern interface{}, handler interface{}) {
m.handleUntyped(pattern, mGET, handler)
m.handleUntyped(pattern, mGET|mHEAD, handler)
}
// Dispatch to the given handler when the pattern matches and the HTTP method is


Loading…
Cancel
Save