// if there's no location to redirect to, we won't
break;
}
constparsedRedirectUrl=newURL(redirectUrl);
if(parsedUrl.protocol==='https:'&&
parsedUrl.protocol!==parsedRedirectUrl.protocol&&
!this._allowRedirectDowngrade){
thrownewError('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
}
// we need to finish reading the response before reassigning response
// which will leak the open socket.
yieldresponse.readBody();
// strip authorization header if redirected to a different hostname
log.warn(`[@octokit/request] "${requestOptions.method}${requestOptions.url}" is deprecated. It is scheduled to be removed on ${headers.sunset}${deprecationLink?`. See ${deprecationLink}`:""}`);