rest-nvim / tree-sitter-http

HTTP grammar for tree-sitter
MIT License
34 stars 16 forks source link

Allow additional characters in Authorisation credentials #30

Closed piersolenski closed 1 month ago

piersolenski commented 4 months ago

I'm getting an error when trying to use = inside my Authorisation value.

For example, using;

Authorisation: Basic YmQ0NT02NTM4YWE5ND03MzJkMTdlN0RiNTdkOGFj0TAwZjhkZj0mYTp5Qzc4aDgmZW85R1A=

results in:

Error executing Lua callback: .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:114: attempt to index local 'req_node' (a nil value)
stack traceback:
    .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:114: in function 'traverse_request'
    .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:432: 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>

This seems related to https://github.com/rest-nvim/tree-sitter-http/pull/23 where it mentions = being disabled for URLs.

lephattan commented 4 months ago

I have the same problem when setting url as a header value. It seems like : and / are not allowed in value as well Example:

###

POST {{BASE_URL}}/registration/registration
Content-Type: application/json
Origin: https://example.com

{
  "hello": "world"
}

Error messages:


[rest.nvim] ERROR: The tree-sitter node at the range [4:8 - 16] has a syntax error and cannot be parsed
[rest.nvim] ERROR: The tree-sitter node at the range [4:8 - 16] has a syntax error and cannot be parsed
Error executing Lua callback: .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:114: attempt to index local 'req_node' (a nil value)
stack traceback:
        .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:114: in function 'traverse_request'
        .../share/nvim/lazy/rest.nvim/lua/rest-nvim/parser/init.lua:430: 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>
image