From fed52d3a3bbb0cf9de73a19985a7ee538eeeb10e Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Wed, 1 Feb 2023 10:14:10 +0100 Subject: [PATCH] simplify means of checking to see if unhandled paths should log a warning --- src/Umbraco.Web.UI.Client/src/core/mocks/browser.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/core/mocks/browser.ts b/src/Umbraco.Web.UI.Client/src/core/mocks/browser.ts index ee0e775325..57b0cd42be 100644 --- a/src/Umbraco.Web.UI.Client/src/core/mocks/browser.ts +++ b/src/Umbraco.Web.UI.Client/src/core/mocks/browser.ts @@ -1,16 +1,13 @@ import { MockedRequest, setupWorker } from 'msw'; - import { handlers } from './browser-handlers'; +import { umbracoPath } from '@umbraco-cms/utils'; const worker = setupWorker(...handlers); export const onUnhandledRequest = (req: MockedRequest) => { - if (req.url.pathname.startsWith('/node_modules/')) return; - if (req.url.pathname.startsWith('/src/')) return; - if (req.url.pathname.startsWith('/icons/')) return; - if (req.destination === 'image') return; - - console.warn('Found an unhandled %s request to %s', req.method, req.url.href); + if (req.url.pathname.startsWith(umbracoPath(''))) { + console.warn('Found an unhandled %s request to %s', req.method, req.url.href); + } }; export const startMockServiceWorker = () =>