Skip to content

Missing lua library support in the post request script #437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
countcain opened this issue Sep 2, 2024 · 1 comment · Fixed by #438
Closed
2 tasks done

Missing lua library support in the post request script #437

countcain opened this issue Sep 2, 2024 · 1 comment · Fixed by #438
Labels
bug Something isn't working

Comments

@countcain
Copy link

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 },
            },
        },
    },
})
@countcain countcain added the bug Something isn't working label Sep 2, 2024
@boltlessengineer
Copy link
Contributor

Thank you for your report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants