Merge pull request #1448 from kaitranntt/codex/fix-browser-page-open/close-handlers

fix(browser): handle DevTools close endpoint response
This commit is contained in:
Kai (Tam Nhu) Tran authored and GitHub committed 2026-05-30 16:09:17 -04:00
commit 5ca9b7b1e2
3 files changed
+59 -2

No files matched your search

+7 -2
View File
@@ -1234,11 +1234,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();
}
@@ -5204,7 +5209,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);