vscode-restclient icon indicating copy to clipboard operation
vscode-restclient copied to clipboard

Provide binary request body by base64 format.

Open zimmem opened this issue 4 years ago • 3 comments

zimmem avatar Jun 03 '21 09:06 zimmem

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 <====
}

wll8 avatar Sep 27 '21 07:09 wll8

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 avatar Sep 06 '22 17:09 alexrqs

@alexrqs This is a feature that the authors wish to provide, currently it does not exist.

wll8 avatar Sep 07 '22 05:09 wll8

any news?

dev-vinicius-andrade avatar Jul 07 '23 02:07 dev-vinicius-andrade