Skip to content

Commit

Permalink
fix lua script and test case
Browse files Browse the repository at this point in the history
Signed-off-by: Megrez Lu <[email protected]>
  • Loading branch information
lujiajing1126 committed Jun 27, 2024
1 parent 894a142 commit 1d2ac3c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ func TestEnsureRoutes(t *testing.T) {
"virtual": "test",
}
u.SetAnnotations(annotations)
specStr := `{"hosts":["echoserver.example.com"],"http":[{"match":[{"headers":{"user_id":{"exact":"123456"}}}],"route":[{"destination":{"host":"echoserver-canary"}}]},{"route":[{"destination":{"host":"echoserver"}}]}]}`
specStr := `{"hosts":["echoserver.example.com"],"http":[{"headers":{"request":{"set":{"x-env-flag":"canary"}}},"match":[{"headers":{"user_id":{"exact":"123456"}}}],"route":[{"destination":{"host":"echoserver-canary"}}]},{"route":[{"destination":{"host":"echoserver"}}]}]}`
var spec interface{}
_ = json.Unmarshal([]byte(specStr), &spec)
u.Object["spec"] = spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ function GenerateMatchedRoutes(spec, matches, stableService, canaryService, stab
if action == "set" or action == "add" then
route["headers"]["request"][action] = {}
for _, header in ipairs(headers) do
local h = {}
h[header["name"]] = header["value"]
table.insert(route["headers"]["request"][action], h)
route["headers"]["request"][action][header["name"]] = header["value"]
end
elseif action == "remove" then
route["headers"]["request"]["remove"] = {}
Expand Down

0 comments on commit 1d2ac3c

Please sign in to comment.