unprint 0.14.2 → 0.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/app.js +15 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unprint",
3
- "version": "0.14.2",
3
+ "version": "0.14.3",
4
4
  "description": "Simplify common web scraping tasks while staying in control of the data.",
5
5
  "main": "src/app.js",
6
6
  "scripts": {
package/src/app.js CHANGED
@@ -950,11 +950,13 @@ function setProxy(instance, options, url) {
950
950
  instance.defaults.httpAgent = proxyAgent;
951
951
  instance.defaults.httpsAgent = proxyAgent;
952
952
 
953
- return;
953
+ return true;
954
954
  }
955
955
 
956
956
  instance.defaults.httpAgent = options.httpsAgent || new http.Agent({ ...options.agent });
957
957
  instance.defaults.httpsAgent = options.httpsAgent || new https.Agent({ ...options.agent });
958
+
959
+ return false;
958
960
  }
959
961
  /* eslint-enable no-param-reassign */
960
962
 
@@ -967,16 +969,6 @@ async function request(url, body, customOptions = {}, method = 'GET') {
967
969
 
968
970
  const { limiter, interval, concurrency } = getLimiter(url, options);
969
971
 
970
- const feedbackBase = {
971
- url,
972
- method,
973
- interval,
974
- concurrency,
975
- options,
976
- };
977
-
978
- events.emit('requestInit', feedbackBase);
979
-
980
972
  const instance = axios.create({
981
973
  data: body,
982
974
  validateStatus: null,
@@ -987,7 +979,18 @@ async function request(url, body, customOptions = {}, method = 'GET') {
987
979
  // httpAgent: options.httpAgent || new http.Agent({ ...options.agent }),
988
980
  });
989
981
 
990
- setProxy(instance, options, url);
982
+ const isProxied = setProxy(instance, options, url);
983
+
984
+ const feedbackBase = {
985
+ url,
986
+ method,
987
+ interval,
988
+ concurrency,
989
+ isProxied,
990
+ options,
991
+ };
992
+
993
+ events.emit('requestInit', feedbackBase);
991
994
 
992
995
  const res = await limiter.schedule(async () => instance.get(url));
993
996