Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to handle env variables in form params #322

Open
hsanson opened this issue Mar 21, 2024 · 0 comments
Open

Unable to handle env variables in form params #322

hsanson opened this issue Mar 21, 2024 · 0 comments

Comments

@hsanson
Copy link
Contributor

hsanson commented Mar 21, 2024

Following test:

POST {{HOST}}/realms/dev/protocol/openid-connect/auth
Content-Type: application/x-www-form-urlencoded

param1={{value1}}&param2=value2&param3=value3

fails with:

[rest.nvim] ERROR: The tree-sitter node at the range [0:0 - 3:7] has a syntax error and cannot be parsed                                                                                              
Error executing Lua callback: ...jin/Projects/vim/rest.nvim/lua/rest-nvim/parser/init.lua:143: attempt to index local 'document_node' (a nil value)                                                         
stack traceback:                                                                                                                                                                                            
        ...jin/Projects/vim/rest.nvim/lua/rest-nvim/parser/init.lua:143: in function 'traverse_variables'                                                                                                   
        ...jin/Projects/vim/rest.nvim/lua/rest-nvim/parser/init.lua:436: in function 'parse'                                                                                                                
        ...yujin/Projects/vim/rest.nvim/lua/rest-nvim/functions.lua:61: in function 'exec'                                                                                                                  
        .../Projects/vim/rest.nvim/lua/rest-nvim/commands.lua:44: in function 'impl'                                                                                                                  
        .../Projects/vim/rest.nvim/lua/rest-nvim/commands.lua:182: in function <.../Projects/vim/rest.nvim/lua/rest-nvim/commands.lua:165>  j

Seems tree-sitter is unable to parse the form params as seen in Tree-sitter inspec:

(document ; [0, 0] - [4, 0]
  (request ; [0, 0] - [3, 7]
    (method) ; [0, 0] - [0, 4]
    (target_url ; [0, 5] - [0, 53]
      (variable ; [0, 5] - [0, 13]
        name: (identifier)) ; [0, 7] - [0, 11]
      (path ; [0, 13] - [0, 53]
        (identifier) ; [0, 14] - [0, 20]
        (identifier) ; [0, 21] - [0, 24]
        (identifier) ; [0, 25] - [0, 33]
        (identifier) ; [0, 34] - [0, 48]
        (identifier))) ; [0, 49] - [0, 53]
    (header ; [1, 0] - [3, 0]
      name: (name) ; [1, 0] - [1, 12]
      value: (value)) ; [1, 13] - [3, 0]
    (form_data ; [3, 0] - [3, 7]
      name: (identifier) ; [3, 0] - [3, 6]
      value: (value))) ; [3, 7] - [3, 7]
  (variable ; [3, 7] - [3, 17]
    name: (identifier)) ; [3, 9] - [3, 15]
  (ERROR ; [3, 17] - [3, 45]
    (identifier) ; [3, 18] - [3, 24]
    (identifier) ; [3, 25] - [3, 31]
    (identifier) ; [3, 32] - [3, 38]
    (identifier))) ; [3, 39] - [3, 45]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant