Skip to content

Commit ac4f29e

Browse files
committed
Assert response.ok when downloading files
1 parent 5e68065 commit ac4f29e

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
@@ -18,6 +18,10 @@ export async function downloadFile({
1818
}: DownloadFileOptions): Promise<string> {
1919
const response = await fetch(url);
2020

21+
assert(
22+
response.ok,
23+
`Request failed with status ${response.status} (${response.statusText})`
24+
);
2125
const etag = response.headers.get('etag');
2226
assert(etag, 'Expected an ETag header');
2327
const cleanEtag = etag.match(/[0-9a-fA-F]/g)?.join('');

0 commit comments

Comments
 (0)