mirror of
https://github.com/yusing/godoxy.git
synced 2025-07-06 06:24:03 +02:00
fix(route): wildcard labels not applied properly
This commit is contained in:
parent
de2383eed7
commit
1c892a35f7
2 changed files with 1 additions and 21 deletions
|
@ -57,8 +57,7 @@ type (
|
||||||
ProxyURL *net.URL `json:"purl,omitempty"`
|
ProxyURL *net.URL `json:"purl,omitempty"`
|
||||||
Idlewatcher *idlewatcher.Config `json:"idlewatcher,omitempty"`
|
Idlewatcher *idlewatcher.Config `json:"idlewatcher,omitempty"`
|
||||||
|
|
||||||
impl route.Route
|
impl route.Route
|
||||||
isValidated bool
|
|
||||||
}
|
}
|
||||||
Routes map[string]*Route
|
Routes map[string]*Route
|
||||||
)
|
)
|
||||||
|
@ -69,10 +68,6 @@ func (r Routes) Contains(alias string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Route) Validate() (err gperr.Error) {
|
func (r *Route) Validate() (err gperr.Error) {
|
||||||
if r.isValidated {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
r.isValidated = true
|
|
||||||
r.Finalize()
|
r.Finalize()
|
||||||
|
|
||||||
// return error if route is localhost:<godoxy_port>
|
// return error if route is localhost:<godoxy_port>
|
||||||
|
|
|
@ -12,20 +12,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRouteValidate(t *testing.T) {
|
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) {
|
t.Run("ReservedPort", func(t *testing.T) {
|
||||||
r := &Route{
|
r := &Route{
|
||||||
Alias: "test",
|
Alias: "test",
|
||||||
|
@ -146,7 +132,6 @@ func TestRouteValidate(t *testing.T) {
|
||||||
}
|
}
|
||||||
err := r.Validate()
|
err := r.Validate()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.True(t, r.isValidated)
|
|
||||||
require.NotNil(t, r.ProxyURL)
|
require.NotNil(t, r.ProxyURL)
|
||||||
require.NotNil(t, r.HealthCheck)
|
require.NotNil(t, r.HealthCheck)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue