rest-nvim / rest.nvim

A fast Neovim http client written in Lua
GNU General Public License v3.0
1.6k stars 142 forks source link

attempt to compare number with nil #451

Closed Mrthnx closed 1 month ago

Mrthnx commented 2 months ago

Prerequisites

Neovim Version

v0.10.1

Operating system/version

Ubuntu 20.04

Actual behavior

Error executing vim.schedule lua callback: ....local/share/nvim/lazy/rest.nvim/lua/rest-nvim/utils.lua:117: attempt to compare number with nil
stack traceback:
    ....local/share/nvim/lazy/rest.nvim/lua/rest-nvim/utils.lua:117: in function 'transform_time'
    ...re/nvim/lazy/rest.nvim/lua/rest-nvim/client/curl/cli.lua:111: in function 'parse_stat_pair'
    ...re/nvim/lazy/rest.nvim/lua/rest-nvim/client/curl/cli.lua:139: in function 'f'
    ...Cellar/neovim/0.10.1/share/nvim/runtime/lua/vim/iter.lua:366: in function 'each'
    ...re/nvim/lazy/rest.nvim/lua/rest-nvim/client/curl/cli.lua:123: in function 'parse_verbose'
    ...re/nvim/lazy/rest.nvim/lua/rest-nvim/client/curl/cli.lua:355: in function <...re/nvim/lazy/rest.nvim/lua/rest-nvim/client/curl/cli.lua:351>

Screenshot_20240909_100701

Expected behavior

correct execution of request

Steps to reproduce

execute command :Rest run

Screenshot_20240909_101121

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 },
            },
        },
    },
})
boltlessengineer commented 2 months ago

What’s the version of installed curl in your OS?

Mrthnx commented 2 months ago

this is version curl --version

curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libid
n2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp
 sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTL
M_WB PSL SPNEGO SSL TLS-SRP UnixSockets
boltlessengineer commented 2 months ago

Can’t reproduce… but I’ll definitely take a look about this tomorrow.

Mrthnx commented 2 months ago

to add that my local has lua 5.3.3 and my nvim lua 5.1

boltlessengineer commented 2 months ago

local lua version should not matter if you installed rest.nvim without errors.

Do you have error only for that request or for all requests?

GET https://api.github.com/users/boltlessengineer

Do you have same error with this http request?

What is the output of running this command from cli?

curl -sSL --verbose -XPOST https://backend.pdmmonitor.com/login -w '%{stderr}? time_total:%{time_total}\n? size_download:%{size_download}'
Mrthnx commented 1 month ago

with the new changes it works, thank you very much.

boltlessengineer commented 1 month ago

Actually that change was for debugging purposes, but glad that it fixed your issue. :)