browserclaw 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -355,7 +355,9 @@ async function isChromeReachable(cdpUrl, timeoutMs = 500, authToken) {
355
355
  const headers = {};
356
356
  if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
357
357
  const res = await fetch(`${cdpUrl.replace(/\/+$/, "")}/json/version`, { signal: ctrl.signal, headers });
358
- return res.ok;
358
+ if (!res.ok) return false;
359
+ const data = await res.json();
360
+ return data != null && typeof data === "object";
359
361
  } catch {
360
362
  return false;
361
363
  } finally {
@@ -371,6 +373,7 @@ async function getChromeWebSocketUrl(cdpUrl, timeoutMs = 500, authToken) {
371
373
  const res = await fetch(`${cdpUrl.replace(/\/+$/, "")}/json/version`, { signal: ctrl.signal, headers });
372
374
  if (!res.ok) return null;
373
375
  const data = await res.json();
376
+ if (!data || typeof data !== "object") return null;
374
377
  return String(data?.webSocketDebuggerUrl ?? "").trim() || null;
375
378
  } catch {
376
379
  return null;