vscode-restclient
vscode-restclient copied to clipboard
Provide binary request body by base64 format.
Since it is in the vscode environment, is it supported to use js to process requests or responses?
Custom script $js:
$js =
(...arg) => { // This is the nodejs execution environment
const base64 = require('base64')
return base64(arg)
}
Use $js:
put https://api.github.com/repos/xxx/xxx
Authorization: {{token}}
{
"message": "Upload", // msg
"content": "{{$js arg1 arg2}}" // auto base64 <====
}
Result:
put https://api.github.com/repos/xxx/xxx
Authorization: {{token}}
{
"message": "Upload", // msg
"content": "IA==" // auto base64 <====
}
hey @wll8, where am I supposed to write
$js =
(...arg) => { // This is the nodejs execution environment
const base64 = require('base64')
return base64(arg)
}
because I tried inside the rest-client-blah-blah.http file but got a bunch of errors, and also, a few tips to process the response will be good please 🙏
@alexrqs This is a feature that the authors wish to provide, currently it does not exist.
any news?