Skip to content

wildcard path param #2754

Closed
Closed
@nnntlh

Description

@nnntlh
  • With issues:
    • Use the search tool before opening a new issue.
    • Please provide source code and commit sha if you found a bug.
    • Review existing issues and provide feedback or react to them.

Description

  wildcard path param ,url not found

How to reproduce

package main

import (
	"fmt"

	"github.com/gin-gonic/gin"
)

func handler(c *gin.Context) {
	fmt.Println(c.Params)
}

func main() {
	g := gin.Default()
	g.GET("/:resources/:name", handler)
	g.GET("/:resources", handler)
	g.GET("/namespaces/:namespace/:resources/:name", handler)
	g.GET("/namespaces/:namespace/:resources", handler)
	g.Run(":9090")
}

Actual result

$ curl http://localhost:9000/namespaces/apps
404 page not found

Environment

  • go version: 1.16
  • gin version (or commit ref): 1.7.2
  • operating system: Ubuntu 20.04.2 LTS

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions