Request routers.
-
Route based on method:
http.Handle("/items", mux.Method{ "GET": getHandler, "PUT": putHandler, })
If no match return a
405 Method Not Allowed. A default implementation of theOPTIONSmethod will return anAllow: ...header listing the defined methods. -
Route based on
ContentTypeheader:http.Handle("/items", mux.ContentType{ "application/xml": xmlItemsGet, "application/json": jsonItemsGet, "*/*": itemsGet, })
If no match return a
415 Unsupported Media Type. -
Route based on
Acceptheader:http.Handle("/items", mux.Accept{ "application/xml": xmlItemsPut, "application/json": jsonItemsPut, "application/x-www-form-urlencoded": itemsPut, })
If no match return a
406 Not Acceptable.