mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
@@ -363,7 +363,7 @@ func Test(t *testing.T, ds models.Datastore) {
|
|||||||
"THIRD": "3",
|
"THIRD": "3",
|
||||||
},
|
},
|
||||||
Headers: http.Header{
|
Headers: http.Header{
|
||||||
"First": []string{"test", "test2"},
|
"First": []string{"test2"},
|
||||||
"Third": []string{"test", "test2"},
|
"Third": []string{"test", "test2"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,9 +150,7 @@ func (r *Route) Update(new *Route) {
|
|||||||
if len(v) == 0 {
|
if len(v) == 0 {
|
||||||
r.Headers.Del(k)
|
r.Headers.Del(k)
|
||||||
} else {
|
} else {
|
||||||
for _, val := range v {
|
r.Headers[k] = v
|
||||||
r.Headers.Add(k, val)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/fnproject/fn/api/id"
|
"github.com/fnproject/fn/api/id"
|
||||||
"github.com/fnproject/fn_go/models"
|
"github.com/fnproject/fn_go/models"
|
||||||
|
"reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRoutes(t *testing.T) {
|
func TestRoutes(t *testing.T) {
|
||||||
@@ -192,4 +193,19 @@ func TestRoutes(t *testing.T) {
|
|||||||
|
|
||||||
DeleteApp(t, s.Context, s.Client, s.AppName)
|
DeleteApp(t, s.Context, s.Client, s.AppName)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Run("multiple-deploy-route-with-headers", func(T *testing.T) {
|
||||||
|
s := SetupDefaultSuite()
|
||||||
|
CreateApp(t, s.Context, s.Client, s.AppName, map[string]string{})
|
||||||
|
routeHeaders := map[string][]string{}
|
||||||
|
routeHeaders["A"] = []string{"a"}
|
||||||
|
routeHeaders["B"] = []string{"b"}
|
||||||
|
DeployRoute(t, s.Context, s.Client, s.AppName, s.RoutePath, s.Image, s.RouteType, s.Format, s.RouteConfig, routeHeaders)
|
||||||
|
sameRoute := DeployRoute(t, s.Context, s.Client, s.AppName, s.RoutePath, s.Image, s.RouteType, s.Format, s.RouteConfig, routeHeaders)
|
||||||
|
if ok := reflect.DeepEqual(sameRoute.Headers, routeHeaders); !ok {
|
||||||
|
t.Error("Route headers should remain the same after multiple deploys with exact the same parameters")
|
||||||
|
}
|
||||||
|
DeleteApp(t, s.Context, s.Client, s.AppName)
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user