浏览代码

Merge branch 'add_unlink' of git://github.com/jamie-stackhouse/gin into jamie-stackhouse-add_unlink

Javier Provecho Fernandez 11 年之前
父节点
当前提交
ad4d82c65c
共有 1 个文件被更改,包括 12 次插入1 次删除
  1. 12 1
      routergroup.go

+ 12 - 1
routergroup.go

@@ -5,9 +5,10 @@
 package gin
 package gin
 
 
 import (
 import (
-	"github.com/julienschmidt/httprouter"
 	"net/http"
 	"net/http"
 	"path"
 	"path"
+
+	"github.com/julienschmidt/httprouter"
 )
 )
 
 
 // Used internally to configure router, a RouterGroup is associated with a prefix
 // Used internally to configure router, a RouterGroup is associated with a prefix
@@ -95,6 +96,16 @@ func (group *RouterGroup) HEAD(relativePath string, handlers ...HandlerFunc) {
 	group.Handle("HEAD", relativePath, handlers)
 	group.Handle("HEAD", relativePath, handlers)
 }
 }
 
 
+// LINK is a shortcut for router.Handle("LINK", path, handle)
+func (group *RouterGroup) LINK(relativePath string, handlers ...HandlerFunc) {
+	group.Handle("LINK", relativePath, handlers)
+}
+
+// UNLINK is a shortcut for router.Handle("UNLINK", path, handle)
+func (group *RouterGroup) UNLINK(relativePath string, handlers ...HandlerFunc) {
+	group.Handle("UNLINK", relativePath, handlers)
+}
+
 // Static serves files from the given file system root.
 // Static serves files from the given file system root.
 // Internally a http.FileServer is used, therefore http.NotFound is used instead
 // Internally a http.FileServer is used, therefore http.NotFound is used instead
 // of the Router's NotFound handler.
 // of the Router's NotFound handler.