Skip to content

Commit 3e86602

Browse files
authored
Assert response.ok when downloading files (#6703)
1 parent ff66d30 commit 3e86602

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/compass-smoke-tests/src/downloads.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ export async function downloadFile({
2121
}: DownloadFileOptions): Promise<string> {
2222
const response = await fetch(url);
2323

24+
assert(
25+
response.ok,
26+
`Request failed with status ${response.status} (${response.statusText})`
27+
);
2428
const etag = response.headers.get('etag');
2529
assert(etag, 'Expected an ETag header');
2630
const cleanEtag = etag.match(/[0-9a-fA-F]/g)?.join('');

0 commit comments

Comments
 (0)