generated curl command inlines file on the CLI instead of referencing payload
I realized with https://github.com/rest-nvim/rest.nvim/pull/202 that shows the curl command used that
< {{TEST_DATA_FOLDER}}/payloads/v2/model.json translates to --data-raw HUGE STRING instead of referencing a file. I am not sure if that's a plenary fault and if we can fix that on our side.
I dont know either if this should be configurable (on a per-request basis for instance) but for my scenarios I would rather have the curl command reference the file on the filesystem with curl --data-raw @file.txt rather than curl --data-raw <INLINED FILE.TXT>
after looking into lua/rest-nvim/request/init.lua , seems like it's our fault: we load the file in memory to be able to replace variables but never write the generated result back. In a way it would be nice to distinguish between files where we want to replace values and files we dont need to. This could speed up request. This can be done in several ways:
- do the replacing just for json ? it looks ok to me but it's a breaking change plus it may make sense for some other format like .txt. Maybe we should limit the replacing for textual formats aka json/etc
- make it controllable via a new symbol aka
<<instead of<or<readonlyto mark that it's not a template file ?
cc @NTBBloodbath
NB: if we do change the format, it could be interesting to follow hurl's format https://github.com/rest-nvim/rest.nvim/issues/195 but seems like they dont have the templating feature of rest.nvim so it doesn't make sense yet.
not tested much but here is an implem https://github.com/rest-nvim/rest.nvim/pull/216 : if you reference a file via <@ file instead of < file the filename will be passed as is to curl, thus making the curl command a ton shorter
rest.nvim no longer has the option to generate curl commands, so this issue is no longer relevant
@teto @NTBBloodbath