mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
Bump node-fetch
This commit is contained in:
parent
c3a97a9a9c
commit
29682445ac
3 changed files with 90 additions and 171 deletions
|
@ -73,8 +73,8 @@ export async function fetchRelease(
|
|||
);
|
||||
}
|
||||
|
||||
// We skip runtime type checks for simplicity (here we cast from `any` to `GithubRelease`)
|
||||
const release: GithubRelease = await response.json();
|
||||
// We skip runtime type checks for simplicity (here we cast from `unknown` to `GithubRelease`)
|
||||
const release = await response.json() as GithubRelease;
|
||||
return release;
|
||||
}
|
||||
|
||||
|
@ -205,6 +205,12 @@ async function downloadFile(
|
|||
throw new Error(`Got response ${res.status} when trying to download a file.`);
|
||||
}
|
||||
|
||||
if (!res.body) {
|
||||
log.error("Empty body while downloading file from", urlString);
|
||||
log.error({ headers: res.headers });
|
||||
throw new Error(`Got empty body when trying to download a file.`);
|
||||
}
|
||||
|
||||
const totalBytes = Number(res.headers.get('content-length'));
|
||||
assert(!Number.isNaN(totalBytes), "Sanity check of content-length protocol");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue