Skip to content

segments after ":name" type will match wrong #7

Open
@mozhata

Description

@mozhata

there are two conflict router:

GET /v1/team/:tid/duty
GET /v1/team/:svc/info

the secode route will not match

package main

import (
	"log"
	"net/http"

	"github.com/beego/mux"
)

func main() {
	m := mux.New()
	m.Get("/v1/team/:tid/duty", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("hello, beego mux\n"))
	})
	m.Get("/v1/team/:svc/info", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("hello, beego mux 2\n"))
	})

	log.Fatal(http.ListenAndServe("127.0.0.1:2222", m))
}

curl:

mozhata@pc:try$ curl http://127.0.0.1:2222/v1/team/ididid/duty
hello, beego mux
mozhata@pc:try$ curl http://127.0.0.1:2222/v1/team/ididid/info
"/v1/team/ididid/info" not implemented

but replace :svc to :tid, these two routes all works

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