rest-nvim / rest.nvim

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

Can't post form-urlencoded data #364

Open gegnew opened 2 months ago

gegnew commented 2 months ago

this is just curl -XPOST <url> -d 'key=val but it doesn't seem possible with rest.nvim. Is there a solution to this?

Referenced disussion:

Originally posted by @jwhoami in https://github.com/rest-nvim/rest.nvim/discussions/259

Drowze commented 2 months ago

Also going through the same. I'd like to use this for quick prototyping - but unfortunately not supporting application/x-www-form-urlencoded is a major block for me 🤔

For instance, I've been trying with:

POST https://login.microsoftonline.com/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/oauth2/v2.0/token
content-type: application/x-www-form-urlencoded

scope=https://graph.microsoft.com/.default&client_id=ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj&client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&grant_type=client_credentials

And this is the error I get:

[rest.nvim] ERROR: The tree-sitter node at the range [0:0 - 3:174] has a syntax error and cannot be parsed
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:436: 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>