trying to assign a dynamic variable as a javascript url in a request

by xfreyje   Last Updated May 16, 2019 05:24 AM

I am trying to dynamically set the url of a Javascript url in a jsreports beforeRender request as follows:

const reporturl = "http://someapi.com/" + var1 + "/" + var2;

request({
  url: reporturl,
  json: true
}, function(err, res, body){
  req.body = ... };
  done()
});

if I use url: "http://someapi.com/123/ABC" statically coded it works fine.



Related Questions


Updated August 22, 2019 02:24 AM

Updated March 05, 2019 04:24 AM

Updated August 10, 2015 21:10 PM

Updated March 03, 2018 19:24 PM

Updated April 08, 2018 09:24 AM