Skip to content

Commit

Permalink
fix(api:node): proxy all local scripts with useLocal, not just main (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sidvishnoi authored Apr 10, 2024
1 parent 0072750 commit 0eb2a8f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions tools/respecDocWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export async function toHTML(src, options = {}) {
async function useLocalReSpec(page, log) {
await page.setRequestInterception(true);

page.on("request", async function requestInterceptor(request) {
page.on("request", async request => {
if (!isRespecScript(request)) {
await request.continue();
return;
Expand All @@ -148,9 +148,6 @@ async function useLocalReSpec(page, log) {
contentType: "text/javascript; charset=utf-8",
body: await readFile(localPath),
});
// Workaround for https://github.com/puppeteer/puppeteer/issues/4208
page.off("request", requestInterceptor);
await page.setRequestInterception(false);
});
}

Expand All @@ -163,9 +160,7 @@ function isRespecScript(req) {
const { host, pathname: path } = new URL(req.url());
switch (host) {
case "www.w3.org":
return (
path.startsWith("/Tools/respec/") && !path.includes("respec-highlight")
);
return path.startsWith("/Tools/respec/");
case "w3c.github.io":
return path.startsWith("/respec/builds/");
default:
Expand Down

0 comments on commit 0eb2a8f

Please sign in to comment.