debug: fix indent of routes dump for DELETE method

'DELETE' is 6 chars and breaks indent of the routes dump (only 5 chars
were reserved for the HTTP method).
This commit is contained in:
Olivier Mengué 2015-12-10 15:15:17 +01:00
parent fe49f0b616
commit 90911f53f2
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ func debugPrintRoute(httpMethod, absolutePath string, handlers HandlersChain) {
if IsDebugging() { if IsDebugging() {
nuHandlers := len(handlers) nuHandlers := len(handlers)
handlerName := nameOfFunction(handlers.Last()) handlerName := nameOfFunction(handlers.Last())
debugPrint("%-5s %-25s --> %s (%d handlers)\n", httpMethod, absolutePath, handlerName, nuHandlers) debugPrint("%-6s %-25s --> %s (%d handlers)\n", httpMethod, absolutePath, handlerName, nuHandlers)
} }
} }

View File

@ -63,7 +63,7 @@ func TestDebugPrintRoutes(t *testing.T) {
defer teardown() defer teardown()
debugPrintRoute("GET", "/path/to/route/:param", HandlersChain{func(c *Context) {}, handlerNameTest}) debugPrintRoute("GET", "/path/to/route/:param", HandlersChain{func(c *Context) {}, handlerNameTest})
assert.Equal(t, w.String(), "[GIN-debug] GET /path/to/route/:param --> github.com/gin-gonic/gin.handlerNameTest (2 handlers)\n") assert.Equal(t, w.String(), "[GIN-debug] GET /path/to/route/:param --> github.com/gin-gonic/gin.handlerNameTest (2 handlers)\n")
} }
func setup(w io.Writer) { func setup(w io.Writer) {