vscode-restclient
vscode-restclient copied to clipboard
Generate code snippet with file as a body content
Hi,
I think It would be nice if "Generate code snippet" would include file path content in generated code, similar to environment variables.
For example: from
POST {{url}} HTTP/1.1
content-type: application/json
< ./request.json
to:
curl --request POST \
--url http://my.url \
--header 'content-type: application/json' \
--data '{"my": "request"}'
(instead of --data '< ./request.json')
@Huachao, thanks, very useful extension. :+1:
curl (and of course other targets such as python, java, ...) also have the ability to send a file.
For example for the the following example request
POST https://example.com/comments HTTP/1.1
< demo.xml
the following curl command could be generated which reads the file
curl --request POST --url https://example.com/comments --data @demo.xml