mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-11 12:09:03 +00:00
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:
3 files changed
+59
-2
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user