DEV: Allow safe_mode and preview_theme_id to work via ember-cli proxy (#17928)

This commit is contained in:
David Taylor 2022-08-15 14:43:43 +01:00 committed by GitHub
parent 3d070b4a32
commit b6c6c803c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -239,6 +239,16 @@ async function buildFromBootstrap(proxy, baseURL, req, response, preload) {
let url = new URL(`${proxy}${baseURL}bootstrap.json`);
url.searchParams.append("for_url", req.url);
const forUrlSearchParams = new URL(req.url, "https://dummy-origin.invalid")
.searchParams;
const reqUrlSafeMode = forUrlSearchParams.get("safe_mode");
if (reqUrlSafeMode) {
url.searchParams.append("safe_mode", reqUrlSafeMode);
}
const reqUrlPreviewThemeId = forUrlSearchParams.get("preview_theme_id");
url.searchParams.append("preview_theme_id", reqUrlPreviewThemeId);
const res = await fetch(url, { headers: req.headers });
const json = await res.json();