Skip to content
This repository was archived by the owner on Feb 27, 2026. It is now read-only.

Commit 9a62306

Browse files
Philipp Giesefrontendphil
authored andcommitted
fix: correctly wait for all responses
1 parent 2449d45 commit 9a62306

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

src/captureResponses.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,15 @@ export const captureResponses = (
3030

3131
const resolve = createResolvable()
3232

33-
if (response.mimeType === "text/html") {
34-
client.on("Network.loadingFinished", async (params) => {
35-
if (params.requestId !== requestId) {
36-
return
37-
}
38-
39-
resolve({
40-
[requestId]: await extractResponseContent(client, requestId),
41-
})
42-
})
43-
} else {
33+
client.on("Network.loadingFinished", async (params) => {
34+
if (params.requestId !== requestId) {
35+
return
36+
}
37+
4438
resolve({
4539
[requestId]: await extractResponseContent(client, requestId),
4640
})
47-
}
41+
})
4842
}
4943

5044
client.on("Network.responseReceived", callback)
@@ -99,7 +93,6 @@ const extractResponseContent = async (
9993
responseBody.base64Encoded ? "base64" : undefined
10094
).toString()
10195
} catch (e) {
102-
console.log(e)
10396
// Resources (i.e. response bodies) are flushed after page commits
10497
// navigation and we are no longer able to retrieve them. In this
10598
// case, fail soft so we still add the rest of the response to the

0 commit comments

Comments
 (0)