H-391: preserve unknown cache state
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -566,10 +566,10 @@ export function eventCollector(sessionId, targetId, {
|
||||
protocol: params.response.protocol,
|
||||
mime_type: params.response.mimeType,
|
||||
headers: redactHeaders(params.response.headers),
|
||||
cache: {
|
||||
cache: bodySources.has(requestId) ? {
|
||||
state: bodySources.get(requestId) === "network" ? "miss" : "hit",
|
||||
source: bodySources.get(requestId),
|
||||
},
|
||||
} : { state: "unknown" },
|
||||
},
|
||||
});
|
||||
break;
|
||||
@@ -792,7 +792,10 @@ async function main(attemptFailures = [], startup = { requested_samples: 1, succ
|
||||
for (const pathname of ["/ok", "/secret", "/large", "/binary", "/secure"]) {
|
||||
await collectBody(cdp, collector, findRequest(collector.records, pathname), maxBodyBytes);
|
||||
}
|
||||
const cachedId = findRequests(collector.records, "/cache").find((requestId) => collector.bodySources.get(requestId) !== "network");
|
||||
const cachedId = findRequests(collector.records, "/cache").find((requestId) => {
|
||||
const source = collector.bodySources.get(requestId);
|
||||
return source && source !== "network";
|
||||
});
|
||||
assert(cachedId, "a repeated force-cache request must be served from browser cache");
|
||||
await collectBody(cdp, collector, cachedId, maxBodyBytes);
|
||||
const failedId = [...collector.requestState.entries()].find(([, state]) => state.has("failed"))?.[0];
|
||||
|
||||
Reference in New Issue
Block a user