Skip to content

Commit 2781453

Browse files
committed
Reset port on redirection #502
1 parent 400b459 commit 2781453

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/utils/httpClient.ts

+10
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ export class HttpClient {
141141
}
142142
return res;
143143
}
144+
],
145+
// Following port reset on redirect can be removed after upgrade got to version 10.0
146+
// https://github.com/sindresorhus/got/issues/719
147+
beforeRedirect: [
148+
opts => {
149+
const redirectHost = ((opts as any).href as string).split('/')[2];
150+
if (!redirectHost.includes(':')) {
151+
delete opts.port;
152+
}
153+
}
144154
]
145155
}
146156
};

0 commit comments

Comments
 (0)