diff --git a/lib/util/http/legacy.ts b/lib/util/http/legacy.ts index 53c8aa347f5da9ac43c661e8cf1c019bde447af2..97c09208c19dcae1096a7a7b9b57a43e7d623a21 100644 --- a/lib/util/http/legacy.ts +++ b/lib/util/http/legacy.ts @@ -1,4 +1,5 @@ // istanbul ignore file +import { parseUrl } from '../url'; import { HttpError } from './types'; // TODO: remove when code is refactored @@ -32,6 +33,13 @@ Object.defineProperty(HttpError.prototype, 'url', { }, }); +Object.defineProperty(HttpError.prototype, 'host', { + get: function url(this: HttpError) { + const { host } = parseUrl(this.response?.url) ?? {}; + return host; + }, +}); + export type GotLegacyError<E = unknown, T = unknown> = HttpError & { statusCode?: number; body: {