Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Commit a7c3a58

Browse files
committed
🔧Minor host tweak
1 parent 4ccc4e5 commit a7c3a58

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

services/HttpClient.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ class HttpClient {
6969
*/
7070
constructor(options = {}, requestOptions = {}) {
7171
this.endPoint = options.endPoint || defaultEndpoint;
72-
const parsedUrl = new URL(this.endPoint);
73-
this.endPointHost = parsedUrl.host;
72+
this.endPointHost = '';
73+
if (this.endPoint) {
74+
const parsedUrl = new URL(this.endPoint);
75+
this.endPointHost = parsedUrl.host;
76+
}
7477
this.options = options;
7578
this.got = got.extend(
7679
Object.assign(
@@ -263,7 +266,9 @@ class HttpClient {
263266
if (!options.headers) {
264267
options.headers = {};
265268
}
266-
options.headers.host = this.endPointHost;
269+
if (this.endPointHost) {
270+
options.headers.host = this.endPointHost;
271+
}
267272
return options;
268273
}
269274

0 commit comments

Comments
 (0)