fix #1804 which is caused by calling middleware twice. (#1805)

Fix: https://github.com/gin-gonic/gin/issues/1804

`allNoRoute` contains middlewares such as `gin.Logger`, `gin.Recovery`, so on.  The correct code is to use `noRoute`.

cc: @MetalBreaker
This commit is contained in:
Sai
2019-03-11 11:52:47 +09:00
committed by Bo-Yi Wu
parent 70a0aba3e4
commit 4a23c4f7b9
2 changed files with 22 additions and 2 deletions
+1 -1
View File
@@ -195,7 +195,7 @@ func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileS
// Check if file exists and/or if we have permission to access it
if _, err := fs.Open(file); err != nil {
c.Writer.WriteHeader(http.StatusNotFound)
c.handlers = group.engine.allNoRoute
c.handlers = group.engine.noRoute
// Reset index
c.index = -1
return