Skip to content

cookies not stored #434

@sheimer

Description

@sheimer

Prerequisites

  • I am using the latest stable release of Neovim
  • I am using the latest version of the plugin

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 },
            },
        },
    },
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions