Skip to content

Missing lua library support in the post request script #437

@countcain

Description

@countcain

Prerequisites

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

Neovim Version

v0.10.0

Operating system/version

macos 14.6.1

Actual behavior

I have a post request script like the following:

###
POST {{baseUrl}}/login
content-type: application/json
user-agent: {{agent}}

{
  "login-email": "{{username}}",
  "login-password": "{{password}}",
  "login-remember": false
}

# @lang=lua
> {%
local body = vim.json.decode(response.body)
client.global.set("token", "Bearer "..body.jwt)
client.global.set("StartDate", os.date("%Y-%m-%dT%H:%M:%SZ", os.time() + 15 * 24 * 3600))
client.global.set("EndDate", os.date("%Y-%m-%dT%H:%M:%SZ", os.time() + 380 * 24 * 3600))
client.global.set("Email", "dev"..math.random(0, 1000).."@briza.com")
%}

Following errors pop up when running it.
Screenshot 2024-09-02 at 5 09 31 PM

I am wondering the new version doesn't support lua std library anymore? Is there a workaround?

Expected behavior

I can use the lua library in the post request script.

Steps to reproduce

Just issue the request.

Other information

No response

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