- hoe to crate midleware fo static route file?
Description
this is the code
## How to reproduce
package main
import (
"fmt"
"github.com/gin-gonic/gin"
)
func main() {
router := gin.Default()
test := router.Group("/:ticker/periode", func(c *gin.Context) {
ticker := c.Param("ticker")
fmt.Println("generating data for the", ticker)
})
test.GET("/hello", func(c *gin.Context) {
fmt.Println("hello")
c.JSON(200, gin.H{"hello": "world"})
})
test.Static("/img", "./img")
router.Run()
}
Expectations
$ curl http://localhost:8080/ANTM/periode/img/jos.png
my expectation is, is a jos.png
Actual result
$ curl -i http://localhost:8080/ANTM/periode/img/jos.png
404
Environment
- go version:1.17
- gin version (or commit ref): v1.7.7
- operating system: Mac
Comment From: iyear
https://github.com/gin-gonic/gin/blob/580e7da6eed01e2926de1240ec31f6473cd1a2af/routergroup.go#L157
You use Group() and avoid this panic, it seems that the source code does not allow you to do this.
The judgment of this seems to be a bug, it should check absolute path