fix(browser): handle DevTools close endpoint response

This commit is contained in:
Kai (Tam Nhu) Tran committed 2026-05-30 14:56:49 -04:00
1 parent 23c819cabc
commit 92252189b1
3 files changed
+59 -2

No files matched your search

+7 -2
View File
@@ -1230,11 +1230,16 @@ function getTools() {
];
}
async function fetchJson(url, options = undefined) {
async function fetchOk(url, options = undefined) {
const response = await fetch(url, options);
if (!response.ok) {
throw new Error(`HTTP ${response.status} for ${url}`);
}
return response;
}
async function fetchJson(url, options = undefined) {
const response = await fetchOk(url, options);
return await response.json();
}
@@ -5193,7 +5198,7 @@ async function handleClosePage(toolArgs) {
activeRecordingSession = null;
}
await fetchJson(`${getHttpUrl()}/json/close/${encodeURIComponent(page.id)}`);
await fetchOk(`${getHttpUrl()}/json/close/${encodeURIComponent(page.id)}`, { method: 'PUT' });
const interceptSession = interceptSessionsByPageId.get(page.id);
if (interceptSession) {
closeSocket(interceptSession.ws);