@autofleet/network 1.2.6 → 1.2.8-alpha

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/index.js +7 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,3 +1,8 @@
1
+ delete process.env['http_proxy'];
2
+ delete process.env['HTTP_PROXY'];
3
+ delete process.env['https_proxy'];
4
+ delete process.env['HTTPS_PROXY'];
5
+
1
6
  const axios = require('axios');
2
7
  const http = require('http');
3
8
  const https = require('https');
@@ -125,11 +130,11 @@ module.exports = class Network {
125
130
  async getAllPages(url, options = {}) {
126
131
  let currentResult = [];
127
132
  let resultsInFirstPage = null;
128
- let lastResultsSize = 0;
133
+ let lastResultsSize = null;
129
134
 
130
135
  const localOptions = { params: {}, ...options };
131
136
  localOptions.params.page = 1;
132
- while(localOptions.params.page === 1 || lastResultsSize === resultsInFirstPage) {
137
+ while((localOptions.params.page === 1 || lastResultsSize === resultsInFirstPage) && lastResultsSize !== 0) {
133
138
  const { data } = await this.get(url, localOptions);
134
139
  lastResultsSize = data.length;
135
140
  if(localOptions.params.page === 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/network",
3
- "version": "1.2.6",
3
+ "version": "1.2.8-alpha",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {