How to upload binary with a post request

Hi. I’m trying to read a binary data from a collection and send it with context.http but I can’t see to make it work. I tried sending the buffer, tried sending the base64 string, and I tried sending it as it is. Nothing worked. Is there a way I can get an example of how to do this?

const url = 'https://httpbin.org/post'

var formData = new FormData();
formData.append(
  "file",
 Buffer.from(data.toBase64()),
  'file'.jpg 
);
  
const result = context.http
  .post({
    url: url,
    headers: headers,
    body: formData,
    encodeBodyAsJSON: true,
  })
  .then((response) => {
    console.log(JSON.stringify(response));
    // The response body is encoded as raw BSON.Binary. Parse it to JSON.
    const ejson_body = EJSON.parse(response.body.text());
    return ejson_body;
  });

When I tried this request on postman, the service returns a json body with several parameters, including the base64 string of the image uploaded, but with this example is comes back with an empty body, so even if its a 200 response, it’s not working.

I also checked the base64 string stored on the collection and it decodes perfectly to the image I uploaded