From a82abe1f0af7d555c4305ea82335b22a13355d7b Mon Sep 17 00:00:00 2001 From: Michael Kriese <michael.kriese@visualon.de> Date: Wed, 24 Mar 2021 10:07:34 +0100 Subject: [PATCH] fix: add http host legacy error property (#9263) --- lib/util/http/legacy.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/util/http/legacy.ts b/lib/util/http/legacy.ts index 53c8aa347f..97c09208c1 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: { -- GitLab