Fix issue when there are 2 similar Routes from different SubRouters
Closed this issue · 1 comments
EvilLord666 commented
This PR reproduces the issue - #17 (test)
func TestHandleFuncForSubRouterSameName(t *testing.T) {
internalSubNet := "192.168.30.0"
handler := NewWebApiHandler(true, internalSubNet)
objectResource := "/api/object/"
handler.HandleFunc(handler.Router, objectResource, func(writer http.ResponseWriter, request *http.Request) {
}, "GET")
service1Router := handler.Router.PathPrefix("/service1").Subrouter()
handler.HandleFunc(service1Router, objectResource, func(writer http.ResponseWriter, request *http.Request) {
}, "POST")
checkOptionRouteCors(t, handler.Router, "/api/object/", internalSubNet, "*", "OPTIONS,GET")
checkOptionRouteCors(t, handler.Router, "/service1/api/object/", internalSubNet, "*", "OPTIONS,POST")
}
EvilLord666 commented
done in 1.4.1