fix and tests

This commit is contained in:
Bryan MacFarlane
2020-04-23 16:26:28 -04:00
parent ab10999b09
commit fbd137758a
2 changed files with 54 additions and 0 deletions

View File

@@ -386,6 +386,16 @@ export class HttpClient {
// which will leak the open socket.
await response.readBody()
// strip authorization header if redirected to a different hostname
if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
for(let header in headers){
// header names are case insensitive
if (header.toLowerCase() === "authorization") {
delete headers[header]
}
}
}
// let's make the request with the new redirectUrl
info = this._prepareRequest(verb, parsedRedirectUrl, headers)
response = await this.requestRaw(info, data)