rest-nvim / rest.nvim

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

Support for HTML request bodies #386

Open bennypowers opened 1 month ago

bennypowers commented 1 month ago

Using release 2.0.1, I got:

POST http://localhost:3333
Content-Type: text/html
Accept: text/html

<rh-card>
  <h2 slot="header">SSR</h2>
</rh-card>
   Error  09:09:57 AM notify.error [rest.nvim] ERROR: The tree-sitter node at the range [0:0 - 5:28] has a syntax error and cannot be parsed
   Error  09:09:57 AM msg_show.lua_error   Rest run Error executing Lua callback: .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:143: attempt to index local 'document_node' (a nil value)
stack traceback:
    .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:143: in function 'traverse_variables'
    .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:434: in function 'parse'
    ...al/share/nvim/lazy/rest.nvim/lua/rest-nvim/functions.lua:61: 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>

More generally, rest.nvim may parse the mimetype in the Content-Type header and parse the request body using the associated ts parser

Originally posted by @bennypowers in https://github.com/rest-nvim/rest.nvim/issues/242#issuecomment-2119116753