rest-nvim / rest.nvim

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

bug(v2): error when cannot get the result's content-type #294

Closed skyf0cker closed 8 months ago

skyf0cker commented 8 months ago

when cannot get the content type from the response, current implement will throw error

image image

got error:

Error executing Lua callback: /Users/dd/.luarocks/share/lua/5.1/nio/tasks.lua:95: Async task failed without callback: The coroutine failed with this message: 
.../share/nvim/lazy/rest.nvim/lua/rest-nvim/result/init.lua:237: attempt to concatenate local 'res_type' (a nil value)
stack traceback:
    .../share/nvim/lazy/rest.nvim/lua/rest-nvim/result/init.lua: in function 'format_body'
    .../share/nvim/lazy/rest.nvim/lua/rest-nvim/result/init.lua:304: in function <.../share/nvim/lazy/rest.nvim/lua/rest-nvim/result/init.lua:303>
stack traceback:
    [C]: in function 'error'
    /Users/dd/.luarocks/share/lua/5.1/nio/tasks.lua:95: in function 'close_task'
    /Users/dd/.luarocks/share/lua/5.1/nio/tasks.lua:117: in function 'step'
    /Users/dd/.luarocks/share/lua/5.1/nio/tasks.lua:145: in function 'run'
    .../share/nvim/lazy/rest.nvim/lua/rest-nvim/result/init.lua:303: in function 'write_res'
    ...al/share/nvim/lazy/rest.nvim/lua/rest-nvim/functions.lua:100: in function 'exec'
    ...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:44: in function 'impl'
    ...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:182: in function <...cal/share/nvim/lazy/rest.nvim/lua/rest-nvim/commands.lua:165>