rest.nvim icon indicating copy to clipboard operation
rest.nvim copied to clipboard

Can't post form-urlencoded data

Open gegnew opened this issue 1 year ago • 1 comments

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

gegnew avatar Apr 16 '24 10:04 gegnew

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>

Drowze avatar Apr 23 '24 14:04 Drowze

Closing this due to v3 release of tree-sitter-http. Now rest.nvim officially supports form-urlencoded body type.

boltlessengineer avatar Aug 23 '24 16:08 boltlessengineer