Skip to content

Commit 091e7e4

Browse files
authored
chore: don't warn for unmocked data: URLs (#1224)
1 parent 8fc9197 commit 091e7e4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

modules/runtime/server/cache.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,12 +710,17 @@ export default defineNitroPlugin(nitroApp => {
710710
const originalFetch = globalThis.fetch
711711
const original$fetch = globalThis.$fetch
712712

713-
// Override native fetch for esm.sh requests
713+
// Override native fetch for esm.sh requests and to inject test fixture responses
714714
globalThis.fetch = async (input: URL | RequestInfo, init?: RequestInit): Promise<Response> => {
715715
const urlStr =
716716
typeof input === 'string' ? input : input instanceof URL ? input.toString() : input.url
717717

718-
if (urlStr.startsWith('/') || urlStr.includes('woff') || urlStr.includes('fonts')) {
718+
if (
719+
urlStr.startsWith('/') ||
720+
urlStr.startsWith('data:') ||
721+
urlStr.includes('woff') ||
722+
urlStr.includes('fonts')
723+
) {
719724
return await originalFetch(input, init)
720725
}
721726

0 commit comments

Comments
 (0)