src/node/update.ts/UpdateProvider/requestResponse
class UpdateProvider:  private async requestResponse(uri: string): Promise<http.IncomingMessage> {
    let redirects = 0
    const maxRedirects = 10
    return new Promise((resolve, reject) => {
      const request = (uri: string): void => {
        logger.debug("Making request", field("uri", uri))
        const isHttps = uri.startsWith("https")
        const agent = httpProxyUri ? new ProxyAgent(httpProxyUri) : undefined
        const httpx = isHttps ? https : http
        const client = httpx.get(uri, { headers: { "User-Agent": "code-server" }, agent }, (response) => {
          if (!response.statusCode || response.statusCode < 200 || response.statusCode >= 400) {
            response.destroy()
            return reject(new Error(`${uri}: ${response.statusCode || "500"}`))
          }

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

          resolve(response)
        })
        client.on("error", reject)
      }
      request(uri)
    })
  }