File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 11##LARS
22<img align =" right " src =" https://raw.githubusercontent.com/go-playground/lars/master/examples/README/test.gif " >
3- ![ Project status] ( https://img.shields.io/badge/version-2.7 -green.svg )
3+ ![ Project status] ( https://img.shields.io/badge/version-2.8 -green.svg )
44[ ![ Build Status] ( https://semaphoreci.com/api/v1/projects/4351aa2d-2f94-40be-a6ef-85c248490378/679708/badge.svg )] ( https://semaphoreci.com/joeybloggs/lars )
55[ ![ Coverage Status] ( https://coveralls.io/repos/github/go-playground/lars/badge.svg?branch=master )] ( https://coveralls.io/github/go-playground/lars?branch=master )
66[ ![ Go Report Card] ( https://goreportcard.com/badge/go-playground/lars )] ( https://goreportcard.com/report/go-playground/lars )
Original file line number Diff line number Diff line change @@ -131,6 +131,13 @@ func (g *routeGroup) Trace(path string, h ...Handler) {
131131 g .handle (TRACE , path , h )
132132}
133133
134+ // Handle allows for any method to be registered with the given
135+ // route & handler. Allows for non standard methods to be used
136+ // like CalDavs PROPFIND and so forth.
137+ func (g * routeGroup ) Handle (method string , path string , h ... Handler ) {
138+ g .handle (method , path , h )
139+ }
140+
134141// Any adds a route & handler to the router for all HTTP methods.
135142func (g * routeGroup ) Any (path string , h ... Handler ) {
136143 g .Connect (path , h ... )
Original file line number Diff line number Diff line change @@ -428,6 +428,8 @@ func TestBadAdd(t *testing.T) {
428428}
429429
430430func TestAddAllMethods (t * testing.T ) {
431+
432+ propfind := "PROPFIND"
431433 fn := func (c Context ) {
432434 if _ , err := c .Response ().Write ([]byte (c .Request ().Method )); err != nil {
433435 panic (err )
@@ -446,6 +448,7 @@ func TestAddAllMethods(t *testing.T) {
446448 l .Patch ("/home/" , fn )
447449 l .Options ("/home/" , fn )
448450 l .Connect ("/home/" , fn )
451+ l .Handle (propfind , "/home/" , fn )
449452
450453 code , body := request (GET , "/" , l )
451454 Equal (t , code , http .StatusOK )
@@ -486,6 +489,10 @@ func TestAddAllMethods(t *testing.T) {
486489 code , body = request (CONNECT , "/home/" , l )
487490 Equal (t , code , http .StatusOK )
488491 Equal (t , body , CONNECT )
492+
493+ code , body = request (propfind , "/home/" , l )
494+ Equal (t , code , http .StatusOK )
495+ Equal (t , body , propfind )
489496}
490497
491498func TestAddAllMethodsMatch (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments