Skip to content

Commit

Permalink
Duplicate type
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Oct 22, 2024
1 parent e45f7c2 commit cb5763b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/RemoteAssetCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,14 @@ class RemoteAssetCache extends AssetCache {
let isDryRun = optionsOverride.dryRun || this.options.dryRun;
this.log(`${isDryRun ? "Fetching" : "Cache miss for"} ${this.displayUrl}`);

let fetchOptions = optionsOverride.fetchOptions || this.options.fetchOptions || {};
let type = optionsOverride.type || this.options.type;

let body;
let type = optionsOverride.type || this.options.type;
if(typeof this.url === "object" && typeof this.url.then === "function") {
body = await this.url;
} else if (typeof this.url === "function" && this.url.constructor.name === "AsyncFunction") {
body = await this.url();
} else {
let fetchOptions = optionsOverride.fetchOptions || this.options.fetchOptions || {};
let response = await fetch(this.url, fetchOptions);
if (!response.ok) {
throw new Error(
Expand All @@ -94,7 +93,6 @@ class RemoteAssetCache extends AssetCache {
);
}

let type = optionsOverride.type || this.options.type;
body = await this.getResponseValue(response, type);
}
if(!isDryRun) {
Expand Down

0 comments on commit cb5763b

Please sign in to comment.