fix(route): wildcard labels not applied properly

This commit is contained in:
yusing 2025-04-09 16:26:09 +08:00
parent de2383eed7
commit 1c892a35f7
2 changed files with 1 additions and 21 deletions

View file

@ -57,8 +57,7 @@ type (
ProxyURL *net.URL `json:"purl,omitempty"`
Idlewatcher *idlewatcher.Config `json:"idlewatcher,omitempty"`
impl route.Route
isValidated bool
impl route.Route
}
Routes map[string]*Route
)
@ -69,10 +68,6 @@ func (r Routes) Contains(alias string) bool {
}
func (r *Route) Validate() (err gperr.Error) {
if r.isValidated {
return nil
}
r.isValidated = true
r.Finalize()
// return error if route is localhost:<godoxy_port>

View file

@ -12,20 +12,6 @@ import (
)
func TestRouteValidate(t *testing.T) {
t.Run("AlreadyValidated", func(t *testing.T) {
r := &Route{
Alias: "test",
Scheme: route.SchemeHTTP,
Host: "example.com",
Port: route.Port{Proxy: 80},
Metadata: Metadata{
isValidated: true,
},
}
err := r.Validate()
require.NoError(t, err, "Validate should return nil for already validated route")
})
t.Run("ReservedPort", func(t *testing.T) {
r := &Route{
Alias: "test",
@ -146,7 +132,6 @@ func TestRouteValidate(t *testing.T) {
}
err := r.Validate()
require.NoError(t, err)
require.True(t, r.isValidated)
require.NotNil(t, r.ProxyURL)
require.NotNil(t, r.HealthCheck)
})