Fix destroying response in update again

I added another reject that doesn't destroy the response.
This commit is contained in:
Asher 2020-11-05 14:34:57 -06:00
parent 7b2752a62c
commit 3f1750cf83
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
1 changed files with 1 additions and 2 deletions

View File

@ -111,14 +111,13 @@ export class UpdateProvider {
if (response.statusCode >= 300) {
++redirects
if (redirects > maxRedirects) {
response.destroy()
if (redirects > maxRedirects) {
return reject(new Error("reached max redirects"))
}
if (!response.headers.location) {
return reject(new Error("received redirect with no location header"))
}
response.destroy()
return request(url.resolve(uri, response.headers.location))
}