feat(browser): add downloads + response bodies

This commit is contained in:
Peter Steinberger
2026-01-12 19:40:52 +00:00
parent 3dbfe65eea
commit d4f7dc067e
8 changed files with 560 additions and 2 deletions

View File

@@ -138,3 +138,47 @@ export async function browserHighlight(
},
);
}
export async function browserResponseBody(
baseUrl: string,
opts: {
url: string;
targetId?: string;
timeoutMs?: number;
maxChars?: number;
profile?: string;
},
): Promise<{
ok: true;
targetId: string;
response: {
url: string;
status?: number;
headers?: Record<string, string>;
body: string;
truncated?: boolean;
};
}> {
const q = buildProfileQuery(opts.profile);
return await fetchBrowserJson<{
ok: true;
targetId: string;
response: {
url: string;
status?: number;
headers?: Record<string, string>;
body: string;
truncated?: boolean;
};
}>(`${baseUrl}/response/body${q}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
targetId: opts.targetId,
url: opts.url,
timeoutMs: opts.timeoutMs,
maxChars: opts.maxChars,
}),
timeoutMs: 20000,
});
}