mirror of
https://github.com/discourse/discourse.git
synced 2025-03-25 04:05:35 +08:00
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.
This commit is contained in:
parent
8437081d94
commit
f0c8bc9e4d
@ -465,7 +465,7 @@ to serve API requests. For example:
|
|||||||
|
|
||||||
app.use(rawMiddleware, async (req, res, next) => {
|
app.use(rawMiddleware, async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
if (this.shouldForwardRequest(req)) {
|
if (this.shouldForwardRequest(req, baseURL)) {
|
||||||
await handleRequest(proxy, baseURL, req, res);
|
await handleRequest(proxy, baseURL, req, res);
|
||||||
} else {
|
} else {
|
||||||
// Fixes issues when using e.g. "localhost" instead of loopback IP address
|
// 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 (
|
if (
|
||||||
[
|
[
|
||||||
"/tests/index.html",
|
`${baseURL}tests/index.html`,
|
||||||
"/ember-cli-live-reload.js",
|
`${baseURL}ember-cli-live-reload.js`,
|
||||||
"/testem.js",
|
`${baseURL}testem.js`,
|
||||||
"/assets/test-i18n.js",
|
`${baseURL}assets/test-i18n.js`,
|
||||||
].includes(request.path)
|
].includes(request.path)
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user