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

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

Closed aktersnurra closed 1 month ago

aktersnurra commented 1 month 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 1 month ago

It is a bug in neovim and not this library.

aktersnurra commented 1 month ago

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