mirror of
https://github.com/gin-gonic/gin.git
synced 2026-04-29 15:08:19 +08:00
Merge f83a7d1df8304bfb17b044813f5d78de9796ad6f into d3ffc9985281dcf4d3bef604cce4e662b1a327a6
This commit is contained in:
commit
64f9177c7d
@ -83,6 +83,8 @@ func (group *RouterGroup) BasePath() string {
|
||||
return group.basePath
|
||||
}
|
||||
|
||||
// Handle registers a new request handle and middleware with the given path and method.
|
||||
// It panics if httpMethod is not a valid HTTP method.
|
||||
func (group *RouterGroup) handle(httpMethod, relativePath string, handlers HandlersChain) IRoutes {
|
||||
absolutePath := group.calculateAbsolutePath(relativePath)
|
||||
handlers = group.combineHandlers(handlers)
|
||||
@ -200,6 +202,7 @@ func (group *RouterGroup) Static(relativePath, root string) IRoutes {
|
||||
|
||||
// StaticFS works just like `Static()` but a custom `http.FileSystem` can be used instead.
|
||||
// Gin by default uses: gin.Dir()
|
||||
// It panics if relativePath contains URL parameters (: or *).
|
||||
func (group *RouterGroup) StaticFS(relativePath string, fs http.FileSystem) IRoutes {
|
||||
if strings.Contains(relativePath, ":") || strings.Contains(relativePath, "*") {
|
||||
panic("URL parameters can not be used when serving a static folder")
|
||||
|
||||
1
utils.go
1
utils.go
@ -26,6 +26,7 @@ const localhostIP = "127.0.0.1"
|
||||
const localhostIPv6 = "::1"
|
||||
|
||||
// Bind is a helper function for given interface object and returns a Gin middleware.
|
||||
// It panics if val is a pointer; pass the struct value directly (e.g., Bind(Struct{}) not Bind(&Struct{})).
|
||||
func Bind(val any) HandlerFunc {
|
||||
value := reflect.ValueOf(val)
|
||||
if value.Kind() == reflect.Ptr {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user