do not hardcode the path
This commit is contained in:
parent
3cac3b6f19
commit
3dc21ead49
2 changed files with 9 additions and 9 deletions
|
@ -41,7 +41,7 @@ local function set_cookie(self, value)
|
|||
ok, err = cookie:set({
|
||||
key = self.cookie_name,
|
||||
value = value,
|
||||
path = "/",
|
||||
path = ngx.var.location_path,
|
||||
domain = ngx.var.host,
|
||||
httponly = true,
|
||||
})
|
||||
|
|
|
@ -40,7 +40,7 @@ end
|
|||
|
||||
describe("Sticky", function()
|
||||
before_each(function()
|
||||
mock_ngx({ var = {} })
|
||||
mock_ngx({ var = { location_path = "/" } })
|
||||
end)
|
||||
|
||||
after_each(function()
|
||||
|
@ -117,7 +117,7 @@ describe("Sticky", function()
|
|||
set = function(self, payload)
|
||||
assert.equal(payload.key, test_backend.sessionAffinityConfig.cookieSessionAffinity.name)
|
||||
assert.equal(payload.value, util[test_backend_hash_fn .. "_digest"](test_backend_endpoint))
|
||||
assert.equal(payload.path, "/")
|
||||
assert.equal(payload.path, ngx.var.location_path)
|
||||
assert.equal(payload.domain, nil)
|
||||
assert.equal(payload.httponly, true)
|
||||
return true, nil
|
||||
|
|
Loading…
Reference in a new issue