mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
@@ -196,7 +196,7 @@ func (s *Server) serve(ctx context.Context, c *gin.Context, appName string, rout
|
|||||||
|
|
||||||
// headers
|
// headers
|
||||||
for header, value := range c.Request.Header {
|
for header, value := range c.Request.Header {
|
||||||
envVars[toEnvName("HEADER", header)] = strings.Join(value, " ")
|
envVars[toEnvName("HEADER", header)] = strings.Join(value, ", ")
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := &task.Config{
|
cfg := &task.Config{
|
||||||
|
|||||||
@@ -230,6 +230,34 @@ func TestRouteExecutions(t *testing.T) {
|
|||||||
|
|
||||||
DeleteRoute(t, s.Context, s.Client, s.AppName, routePath)
|
DeleteRoute(t, s.Context, s.Client, s.AppName, routePath)
|
||||||
|
|
||||||
|
routePath = "/os.environ"
|
||||||
|
image = "denismakogon/os.environ"
|
||||||
|
routeType = "sync"
|
||||||
|
CreateRoute(t, s.Context, s.Client, s.AppName, routePath, image, routeType,
|
||||||
|
s.RouteConfig, s.RouteHeaders)
|
||||||
|
|
||||||
|
t.Run("verify-headers-separator", func(t *testing.T) {
|
||||||
|
u := url.URL{
|
||||||
|
Scheme: "http",
|
||||||
|
Host: Host(),
|
||||||
|
}
|
||||||
|
u.Path = path.Join(u.Path, "r", s.AppName, routePath)
|
||||||
|
content := &bytes.Buffer{}
|
||||||
|
output := &bytes.Buffer{}
|
||||||
|
CallFN(u.String(), content, output, "POST",
|
||||||
|
[]string{
|
||||||
|
"ACCEPT: application/xml",
|
||||||
|
"ACCEPT: application/json; q=0.2",
|
||||||
|
})
|
||||||
|
res := output.String()
|
||||||
|
if !strings.Contains("application/xml, application/json; q=0.2", res) {
|
||||||
|
t.Errorf("HEADER_ACCEPT='application/xml, application/json; q=0.2' "+
|
||||||
|
"should be in output, have:\n%", res)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
DeleteRoute(t, s.Context, s.Client, s.AppName, routePath)
|
||||||
|
|
||||||
routePath = "/log"
|
routePath = "/log"
|
||||||
image = "funcy/log:0.0.1"
|
image = "funcy/log:0.0.1"
|
||||||
routeType = "async"
|
routeType = "async"
|
||||||
|
|||||||
Reference in New Issue
Block a user