Skip to content

registering a child wildcard router masks the parent #72

@frankli0324

Description

@frankli0324

This test describes the issue:

func Test(t *testing.T) {
	r := router.New()
	r.GET("/{path:*}", func(ctx *fasthttp.RequestCtx) {
		ctx.WriteString("hello")
	})
	r.GET("/test/{path:*}", func(ctx *fasthttp.RequestCtx) {
		ctx.WriteString("world")
	})
	do := func(uri string) string {
		rc := &fasthttp.RequestCtx{
			Request: *fasthttp.AcquireRequest(),
		}
		rc.Request.SetRequestURI(uri)
		r.Handler(rc)
		return string(rc.Response.Body())
	}
	assert.Equal(t, do("/tes"), "hello")
	assert.Equal(t, do("/test/test"), "world")
	assert.Equal(t, do("/test"), "???")
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions