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

Variables do not expand when using content type application/x-www-form-urlencoded #490

Closed kvrohit closed 1 week ago

kvrohit commented 2 weeks ago

Prerequisites

Neovim Version

0.10.2

Operating system/version

Ubuntu (WSL)

Actual behavior

Variables do not expand with POST content type application/x-www-form-urlencoded

Expected behavior

Variable expansion should be supported.

Steps to reproduce

  1. Create a POST request with the following content:
    
    ###
    # @name PostTest
    @var=bar
    POST https://postman-echo.com/post
    Content-Type: application/x-www-form-urlencoded

foo={{var}}

2. Execute the request.
3. Observe the response from the server.

### Other information

Response:

{ "args": {}, "data": "", "files": {}, "form": { "foo": "{{var}}" }, "headers": { "host": "postman-echo.com", "x-request-start": "t=1730401174.207", "connection": "close", "content-length": "11", "x-forwarded-proto": "https", "x-forwarded-port": "443", "x-amzn-trace-id": "Root=1-6723d396-0cbe909e583e8e94479fda5e", "accept": "/", "content-type": "application/x-www-form-urlencoded", "user-agent": "rest.nvim v3.8.3", "cookie": "sails.sid=s%3AGNXG-3IYuvRIqpi1Or_CrvPKWsX6fJb8.uB%2BjZkyfdaQldk28UBWfipofF%2BJ9SRmqeKOA8tG0tGo" }, "json": { "foo": "{{var}}" }, "url": "https://postman-echo.com/post" }


### Repro (`lazy.nvim`)

```lua
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 },
            },
        },
    },
})