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

bug: broken query parameters #355

Closed daniilrozanov closed 2 months ago

daniilrozanov commented 2 months ago

My server does not processes query parameters properly from this client. To research this problem, i used simple public echo server. My query.http is

 GET https://echo.free.beeceptor.com/sample-request?author=beeceptor

Comparing with curl command, which is

curl -v "https://echo.free.beeceptor.com/sample-request?author=beeceptor"

What i suppose to expect from this is, according to this page,

{
  "method": "GET",
  "path": "/sample-request?q=beeceptor",
  "ip": "68.53.23.246",
  "headers": {
    "host": "echo.free.beeceptor.com",
    "user-agent": "curl/7.88.1",
    "accept": "*/*",
    "accept-encoding": "gzip"
  },
  "parsedQueryParams": {
    "author": "beeceptor" // <--- curl, as expected
  }
}

Instead, reply body is

   "method": "GET",
    "protocol": "https",
    "host": "echo.free.beeceptor.com",
    "path": "/sample-request?author%3dbeeceptor",
    "ip": "68.53.23.246",
   "headers": {
      "Host": "echo.free.beeceptor.com",
      "Accept": "*/*",
      "Accept-Encoding": "gzip"
    },
   "parsedQueryParams": {
      "author=beeceptor": "" // <-- rest.nvim, wrong
    }
  }

I've tested it for multiple arguments, same result, e.g. for ?id1=1&id2=2 reply contains "id1=1&id2=2" : "". (

daniilrozanov commented 2 months ago

Ok, this works fine if i set encode_url = false in setup config. Is it supposed to behave like this? Or something else will go bad with encode_url = false

NTBBloodbath commented 2 months ago

Hi, can you please update the plugin and see if the issue persists after merging #354? I think it may be related

daniilrozanov commented 2 months ago

@NTBBloodbath I actually did #356 PR too)

daniilrozanov commented 2 months ago

@NTBBloodbath Yes, #354 is the same as mine, the issue is gone. In my PR #356 i mentioned some details after main part, which may be kinda feature request. What do you think about it?