Hi Bogdan,
there is a function in our "internal" module for this, which we use e.g. for downloading foxx apps from their github repository.
You have two options in your Foxx Controller:
1)
var internal = require("internal");
internal.download(url, body, options, path-to-outfile);
Replace the url and body accordingly.
The body of the answer will be written to outfile.
Options is a JSON object to define header options e.g. {"method": "GET"}
2)
var internal = require("internal");
var result = internal.download(url, body, options);
result will then contain the complete result (including: headers, body, status etc.)
hope that helps,
best
Michael