-
Notifications
You must be signed in to change notification settings - Fork 537
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
support variable when sourcing payload from file #1731
Comments
Hi @teto, at least reading our grammar it should be actually supported => https://hurl.dev/docs/grammar.html#filename 😅 Yet, we haven't implemented it. See also #464 with the same issue. We should really implement it asap! |
feel free to close as duplicate then. when you mention a grammar, there is no tree-sitter grammar implemented yet ? I ask because I've written one (incomplete) for rest.nvim but it's nice to list query, filter them etc. The way hurl is used, I dont think it's necessary but that might be a fun project if someone wanna play with tree-sitter :) |
We've have to work around tooling, a tree-sitter parser is certainly on our radar! No work has started yet though. |
Is there a reason why absolute paths can't be used ?
It works with --file-root but still I was surprised :) EDIT: I have other requests that contain fullpaths and hurl didn't complain then :/ the first file exists, I dont understand why it didn't work the first time |
We have make this constraint for security reason. If the included file is in a children directory of the Hurl file parent folder, file inclusion should work without |
about the treesitter grammar, there is already one actually ^^' |
@jcamiel is there any update in using and loading a file-based content (e.g. for the request body or only a JSON value) in a |
Hi @ppaulweber you can use a file body now (see https://hurl.dev/docs/request.html#file-body)
Do you have something else in mind (or needs)? |
@jcamiel great, thx for the quick reply ... yes, my use case would be more in the sense to include a file contents as e.g. JSON string value in the form of:
The problem with using just directly variables is on the newline and escape encoding in the variable string itself. Therefore, a "include" or "file load" on specific positions in the JSON payload would be one of my current needs. |
OK, that's very clear. We have already |
@jcamiel perfect, good to know ... let me know if I can help out with the implementation or is there already a dedicated issue or PR for this? |
Thanks, first we need to state and finalize what will be the syntax (and what we can support for generators). I'll link here the PR/issues as soon as we advance. |
Problem to solve
I would like to be able to use a variable in the statement referencing an external payload
file,{{TEST_DATA_FOLDER}}/v2/payload.json;
but that doesn't seem supported at the moment.
Proposal
Interpolate .env variables in the
file,<path>
statementAdditional context and resources
I am a user/maintainer of https://github.com/rest-nvim/rest.nvim and I would be ready to have rest.nvim format converge to hurl's format that looks easier to parse with e.g., tree-sitter. rest-nvim/rest.nvim#195 .
rest.nvim has some advantages over hurl.nvim (can run per-request, I can select their order interactively etc) but hurl is more robust. I would like to be able to use both tools on the same file (or the ability to export/import from both formats easily).
Tasks to complete
The text was updated successfully, but these errors were encountered: