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

Null values not included in the request with json body #376

Closed aktersnurra closed 6 months ago

aktersnurra commented 6 months ago

Hi,

When I try to make a request like this:

PUT https://example.com
Content-Type: application/json

{
  "id": "123",
  "foo": [
    {
      "id": "456",
      "bar" : null
    }
  ]
}

the "bar" parameter is lost in the parsing step. I assume that this should not happen from inspecting the code here. Anyone got an idea why I am experiencing this? To me it is not obvious at least.

Is the previewing of curl command deprecated? I see that it is in the config, but I cannot find references in the code.

Any help is much appreciated, I really enjoy this plugin, thanks!

EDIT: it is this line that removes all elements with null values.

aktersnurra commented 6 months ago

It is a bug in neovim and not this library.

aktersnurra commented 6 months ago

I create a PR since lua-tables cannot hold nil values.