unprint 0.11.8 → 0.11.10

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 +9 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unprint",
3
- "version": "0.11.8",
3
+ "version": "0.11.10",
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
@@ -858,14 +858,20 @@ async function request(url, body, customOptions = {}, method = 'GET') {
858
858
  ...options,
859
859
  timeout: options.timeout,
860
860
  signal: options.abortSignal,
861
- httpAgent: new http.Agent({ ...options.agent }),
862
- httpsAgent: new https.Agent({ ...options.agent }),
861
+ httpAgent: options.httpAgent || new http.Agent({ ...options.agent }),
862
+ httpsAgent: options.httpsAgent || new https.Agent({ ...options.agent }),
863
863
  });
864
864
 
865
865
  if (!(res.status >= 200 && res.status < 300)) {
866
866
  handleError(new Error(`HTTP response from ${url} not OK (${res.status} ${res.statusText}): ${res.data}`), 'HTTP_NOT_OK');
867
867
 
868
- return res.status;
868
+ return {
869
+ ok: false,
870
+ status: res.status,
871
+ statusText: res.statusText,
872
+ response: res,
873
+ res,
874
+ };
869
875
  }
870
876
 
871
877
  const base = {