Skip to content

Commit

Permalink
chore: [#1688] Adds unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
capricorn86 committed Jan 20, 2025
1 parent dc7a196 commit 731585f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/fetch/Fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default class Fetch {
window: this.#window,
response: this.response,
request: this.request
})
})
: undefined;
return interceptedResponse instanceof Response ? interceptedResponse : this.response;
}
Expand Down Expand Up @@ -476,7 +476,7 @@ export default class Fetch {
window: this.#window,
response: await response,
request: this.request
})
})
: undefined;
this.#browserFrame[PropertySymbol.asyncTaskManager].endTask(taskID);
const returnResponse =
Expand Down
6 changes: 3 additions & 3 deletions packages/happy-dom/src/fetch/SyncFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default class SyncFetch {
? this.interceptor.beforeSyncRequest({
request: this.request,
window: this.#window
})
})
: undefined;
if (typeof beforeRequestResponse === 'object') {
return beforeRequestResponse;
Expand Down Expand Up @@ -141,7 +141,7 @@ export default class SyncFetch {
window: this.#window,
response,
request: this.request
})
})
: undefined;
return typeof interceptedResponse === 'object' ? interceptedResponse : response;
}
Expand Down Expand Up @@ -493,7 +493,7 @@ export default class SyncFetch {
window: this.#window,
response: redirectedResponse,
request: this.request
})
})
: undefined;
const returnResponse =
typeof interceptedResponse === 'object' ? interceptedResponse : redirectedResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class VirtualServerUtility {
}
if (baseURL) {
const path = requestURL.slice(baseURL.href.length).split('?')[0].split('#')[0];
return Path.join(Path.resolve(virtualServer.directory), path);
return Path.join(Path.resolve(virtualServer.directory), path.replaceAll('/', Path.sep));
}
}
return null;
Expand Down

0 comments on commit 731585f

Please sign in to comment.