You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not particularly experienced with Gin, so I might well have gotten something wrong here. However, the following behavior appears strange to me. Consider this small example:
package main
import (
"net/http""github.com/gin-gonic/gin"
)
funcmain() {
r:=gin.New()
// useless because of https://github.com/golang/go/blob/a7e16abb22f1b249d2691b32a5d20206282898f2/src/net/http/fs.go#L587, but anyway ...r.StaticFile("/index.html", "./public/index.html")
r.StaticFile("/robots.txt", "./public/robots.txt")
r.GET("/:id", func(c*gin.Context) {
c.JSON(http.StatusOK, gin.H{"status": "success"})
})
r.Run()
}
If I remove the robots.txt handler, the third request will be 200 instead. Looks like if my request's path has a prefix, which is also a prefix of one of the other handlers, things get messed up.
I'm not particularly experienced with Gin, so I might well have gotten something wrong here. However, the following behavior appears strange to me. Consider this small example:
Expected vs. actual behavior
If I remove the
robots.txt
handler, the third request will be200
instead. Looks like if my request's path has a prefix, which is also a prefix of one of the other handlers, things get messed up.Might be a duplicate of #2682.
The text was updated successfully, but these errors were encountered: