Skip to content

Commit bc18d43

Browse files
committed
Make refresh work when viewing gitcasso-modified with har:view
1 parent a5efb9e commit bc18d43

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

browser-extension/tests/har-view.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ async function loadHar(filename: string) {
6262
return harData
6363
}
6464

65+
// Add redirect routes for each PAGES URL to handle refreshes
66+
Object.entries(PAGES).forEach(([key, url]) => {
67+
try {
68+
const urlObj = new URL(url)
69+
app.get(urlObj.pathname, (_req, res) => {
70+
res.redirect(`/page/${key}.har/gitcasso`)
71+
})
72+
} catch (error) {
73+
console.warn(`Could not create redirect route for ${key}: ${url}`)
74+
}
75+
})
76+
6577
// List available HAR files
6678
app.get('/', async (_req, res) => {
6779
try {

0 commit comments

Comments
 (0)