@mherod/get-cookie 2.0.0-rc.12 → 2.0.0-rc.13

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.
package/dist/index.js CHANGED
@@ -788,9 +788,10 @@ function $2d84054eb5f070a6$export$f266452a5050185d(url) {
788
788
  }
789
789
 
790
790
 
791
+ const $cfc07ae4aa2c7e44$var$userAgent = new (0, ($parcel$interopDefault($7oI3p$useragents)))().toString();
791
792
  async function $cfc07ae4aa2c7e44$export$b24a545a0b39f491(url, options = {}, fetch = (0, $7oI3p$crossfetch.fetch)) {
792
793
  const headers = {
793
- "User-Agent": new (0, ($parcel$interopDefault($7oI3p$useragents)))().toString()
794
+ "User-Agent": $cfc07ae4aa2c7e44$var$userAgent
794
795
  };
795
796
  const defaultOptions = {
796
797
  headers: headers,
@@ -825,9 +826,12 @@ async function $cfc07ae4aa2c7e44$export$b24a545a0b39f491(url, options = {}, fetc
825
826
  // }
826
827
  }
827
828
  const newUrl = res.headers.get("location");
828
- if (res.redirected || newUrl && newUrl !== url2) {
829
- if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log((0, $7oI3p$colorette.blue)(`Redirected to `), (0, $7oI3p$colorette.yellow)(newUrl));
830
- return $cfc07ae4aa2c7e44$export$b24a545a0b39f491(newUrl, newOptions1);
829
+ if (res.status >= 300 && res.status < 400) {
830
+ if (newUrl && newUrl !== url2) {
831
+ if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).verbose) console.log((0, $7oI3p$colorette.blue)(`Redirected to `), (0, $7oI3p$colorette.yellow)(newUrl));
832
+ return $cfc07ae4aa2c7e44$export$b24a545a0b39f491(//
833
+ newUrl, newOptions1, fetch);
834
+ } else throw new Error("Redirected but no new location");
831
835
  }
832
836
  const arrayBuffer1 = res.arrayBuffer();
833
837
  async function arrayBuffer() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mherod/get-cookie",
3
- "version": "2.0.0-rc.12",
3
+ "version": "2.0.0-rc.13",
4
4
  "description": "Node.js module for querying a local user's Chrome cookie",
5
5
  "source": "src/index.ts",
6
6
  "bin": "dist/cli.js",
@@ -64,7 +64,13 @@ export async function fetchWithCookies(
64
64
  if (parsedArgs.verbose) {
65
65
  console.log(blue(`Redirected to `), yellow(newUrl));
66
66
  }
67
- return fetchWithCookies(newUrl, newOptions1);
67
+ return fetchWithCookies(
68
+ //
69
+ newUrl,
70
+ newOptions1,
71
+ fetch
72
+ //
73
+ );
68
74
  } else {
69
75
  throw new Error("Redirected but no new location");
70
76
  }