mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-15 00:17:09 +00:00
fix(browser): handle DevTools close endpoint response
This commit is contained in:
1 parent
23c819cabc
commit
92252189b1
3 files changed
+59
-2
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user