Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions packages/ui/client/composables/client/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,16 @@ export function createStaticClient(): VitestClient {

async function registerMetadata() {
const res = await fetch(window.METADATA_PATH!)
const contentType = res.headers.get('content-type')?.toLowerCase() || ''
if (
contentType.includes('application/gzip')
|| contentType.includes('application/x-gzip')
) {
const compressed = new Uint8Array(await res.arrayBuffer())
const decompressed = strFromU8(decompressSync(compressed))
const content = new Uint8Array(await res.arrayBuffer())

// Check for gzip magic numbers (0x1f 0x8b) to determine if content is compressed
// This handles cases where Content-Encoding: gzip causes browser to auto-decompress
Comment thread
hi-ogawa marked this conversation as resolved.
Outdated
if (content.length >= 2 && content[0] === 0x1F && content[1] === 0x8B) {
const decompressed = strFromU8(decompressSync(content))
metadata = parse(decompressed) as HTMLReportMetadata
}
else {
metadata = parse(await res.text()) as HTMLReportMetadata
metadata = parse(strFromU8(content)) as HTMLReportMetadata
}
const event = new Event('open')
ctx.ws.dispatchEvent(event)
Expand Down
Loading