From f0c8bc9e4dd5d81890e3cb2159f7d855c3f2a8d4 Mon Sep 17 00:00:00 2001 From: Jeff Wong <awole20@gmail.com> Date: Thu, 1 Dec 2022 16:33:56 -0800 Subject: [PATCH] DEV: handle ember-cli test proxying for relative roots Allow tests to be able to be found and run when DISCOURSE_RELATIVE_ROOT is set. --- app/assets/javascripts/bootstrap-json/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/bootstrap-json/index.js b/app/assets/javascripts/bootstrap-json/index.js index 5b708c1c96b..44414a95842 100644 --- a/app/assets/javascripts/bootstrap-json/index.js +++ b/app/assets/javascripts/bootstrap-json/index.js @@ -465,7 +465,7 @@ to serve API requests. For example: app.use(rawMiddleware, async (req, res, next) => { try { - if (this.shouldForwardRequest(req)) { + if (this.shouldForwardRequest(req, baseURL)) { await handleRequest(proxy, baseURL, req, res); } else { // Fixes issues when using e.g. "localhost" instead of loopback IP address @@ -486,13 +486,13 @@ to serve API requests. For example: }); }, - shouldForwardRequest(request) { + shouldForwardRequest(request, baseURL) { if ( [ - "/tests/index.html", - "/ember-cli-live-reload.js", - "/testem.js", - "/assets/test-i18n.js", + `${baseURL}tests/index.html`, + `${baseURL}ember-cli-live-reload.js`, + `${baseURL}testem.js`, + `${baseURL}assets/test-i18n.js`, ].includes(request.path) ) { return false;