Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async sendOutgoingRequestToRemote(): Promise {
const parsedUrl = new URL(this.linkEntry.remoteUrl);
let client: Client;
if (parsedUrl.protocol === 'https:') {
client = Client.https({
host: parsedUrl.hostname,
port: +parsedUrl.port,
});
} else if (parsedUrl.protocol === 'http:') {
client = Client.http({
host: parsedUrl.hostname,
port: +parsedUrl.port,
});
} else {
throw new Error(`Invalid protocol in linkEntry [${parsedUrl.protocol}]`);
}
// Call RPC for remote Engine
logger.debug(`Calling remote Engine ${this.linkEntry.remoteUrl}`);
const resp = await client.request('vaults.linked.get_linked_data', { linkEntry: this.linkEntry });