Skip to content

Commit 0f2c2ea

Browse files
authored
Merge pull request #4 from ancs21/fix/cdp-turnstile-compat
fix: mocked request headers and DiffDialog crash
2 parents 8d96d67 + 9e9cb8d commit 0f2c2ea

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

public/background.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,7 @@ chrome.debugger.onEvent.addListener(async (source, method, params) => {
475475
type: 'fetch',
476476
method: reqMethod,
477477
url,
478-
requestHeaders: Object.fromEntries(
479-
(params.request.headers || []).map(h => [h.name, h.value])
480-
),
478+
requestHeaders: params.request.headers || {},
481479
requestBody: params.request.postData || null,
482480
status: matchedMock.status || 200,
483481
statusText: 'OK (Mocked)',

src/sidepanel/components/views/DiffDialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export function DiffDialog({
8585
<div className="flex-1 px-4 py-2 border-r border-border bg-surface">
8686
<div className="flex items-center gap-2">
8787
<span className="text-[10px] font-mono font-semibold text-emerald-600">{req1.method}</span>
88-
<span className="text-[10px] text-text-muted truncate">{new URL(req1.url).pathname}</span>
88+
<span className="text-[10px] text-text-muted truncate">{(() => { try { return new URL(req1.url).pathname } catch { return req1.url } })()}</span>
8989
</div>
9090
<div className="text-[10px] text-text-muted mt-0.5">
9191
Status: {req1.status}{req1.duration}ms
@@ -94,7 +94,7 @@ export function DiffDialog({
9494
<div className="flex-1 px-4 py-2 bg-surface">
9595
<div className="flex items-center gap-2">
9696
<span className="text-[10px] font-mono font-semibold text-blue-600">{req2.method}</span>
97-
<span className="text-[10px] text-text-muted truncate">{new URL(req2.url).pathname}</span>
97+
<span className="text-[10px] text-text-muted truncate">{(() => { try { return new URL(req2.url).pathname } catch { return req2.url } })()}</span>
9898
</div>
9999
<div className="text-[10px] text-text-muted mt-0.5">
100100
Status: {req2.status}{req2.duration}ms

0 commit comments

Comments
 (0)