Skip to content
Snippets Groups Projects
Unverified Commit 0e707a49 authored by Sergio Zharinov's avatar Sergio Zharinov Committed by GitHub
Browse files

fix(maven): Use different Http instances per hostType (#5900)

parent 3e27dcd8
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,14 @@ import { DatasourceError } from '../common';
import { id, MAVEN_REPO } from './common';
const http = new Http(id);
const http: Record<string, Http> = {};
function httpByHostType(hostType: string): Http {
if (!http[hostType]) {
http[hostType] = new Http(hostType);
}
return http[hostType];
}
const getHost = (x: string): string => new url.URL(x).host;
......@@ -46,7 +53,8 @@ export async function downloadHttpProtocol(
): Promise<string | null> {
let raw: { body: string };
try {
raw = await http.get(pkgUrl.toString());
const httpClient = httpByHostType(hostType);
raw = await httpClient.get(pkgUrl.toString());
} catch (err) {
const failedUrl = pkgUrl.toString();
if (isNotFoundError(err)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment