From a48f83c9a1a1ed38bc7d233dc84bb0693843552f Mon Sep 17 00:00:00 2001 From: Jamie Stackhouse Date: Mon, 15 Dec 2014 13:19:51 -0400 Subject: [PATCH 1/2] Adding helper functions to router group for LINK and UNLINK. --- routergroup.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/routergroup.go b/routergroup.go index 8b2ebdd2..60897b12 100644 --- a/routergroup.go +++ b/routergroup.go @@ -5,9 +5,10 @@ package gin import ( - "github.com/julienschmidt/httprouter" "net/http" "path" + + "github.com/julienschmidt/httprouter" ) // 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) } +// 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. // Internally a http.FileServer is used, therefore http.NotFound is used instead // of the Router's NotFound handler. From d9d83deb250a8172c9380c0daf57ceeda7feb8be Mon Sep 17 00:00:00 2001 From: Javier Provecho Fernandez Date: Sun, 4 Jan 2015 02:00:19 +0100 Subject: [PATCH 2/2] Apply gofmt to PR #179 --- routergroup.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/routergroup.go b/routergroup.go index 60897b12..8e02a402 100644 --- a/routergroup.go +++ b/routergroup.go @@ -5,10 +5,9 @@ package gin import ( + "github.com/julienschmidt/httprouter" "net/http" "path" - - "github.com/julienschmidt/httprouter" ) // Used internally to configure router, a RouterGroup is associated with a prefix