Prerequisites
Neovim Version
0.10.1
Operating system/version
MacOS 11.5
Actual behavior
A set-cookie header is set, the cookie gets parsed, but the clean() method in lua/rest-nvim/cookie_jar.lua filters the cookie before it is saved to the cookie file.
Expected behavior
The cookie should not be filtered if it is not expired.
Steps to reproduce
try e.g. GET https://google.com
The cookie file stays empty. After changing the condition in clean() like below, some google cookies are stored.
Other information
The filter function used in clean() method keeps an item, if true is returned. So the condition will work correctly the other way round:
return cookie.max_age ~= 0 or cookie.expires >= os.time()
instead of
return cookie.max_age == 0 or cookie.expires < os.time()
Let me know if I can help with a merge request.
Repro (lazy.nvim)
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro({
spec = {
"rest-nvim/rest.nvim",
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
main = "nvim-treesitter.configs",
opts = {
ensure_installed = { "http" },
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
},
},
},
})
Prerequisites
Neovim Version
0.10.1
Operating system/version
MacOS 11.5
Actual behavior
A set-cookie header is set, the cookie gets parsed, but the
clean()method inlua/rest-nvim/cookie_jar.luafilters the cookie before it is saved to the cookie file.Expected behavior
The cookie should not be filtered if it is not expired.
Steps to reproduce
try e.g. GET https://google.com
The cookie file stays empty. After changing the condition in
clean()like below, some google cookies are stored.Other information
The
filterfunction used inclean()method keeps an item, iftrueis returned. So the condition will work correctly the other way round:return cookie.max_age ~= 0 or cookie.expires >= os.time()instead of
return cookie.max_age == 0 or cookie.expires < os.time()Let me know if I can help with a merge request.
Repro (
lazy.nvim)