From 7d135d77e13d3085e44568a4368518129c6c3e48 Mon Sep 17 00:00:00 2001 From: Lord Rasta Date: Fri, 31 May 2019 13:48:41 +0200 Subject: [PATCH 1/2] Create uri with URL object --- packages/botkit-plugin-cms/src/cms.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/botkit-plugin-cms/src/cms.ts b/packages/botkit-plugin-cms/src/cms.ts index a7c16802c..73fa8c66b 100644 --- a/packages/botkit-plugin-cms/src/cms.ts +++ b/packages/botkit-plugin-cms/src/cms.ts @@ -70,7 +70,7 @@ export class BotkitCMSHelper { private async apiRequest(uri: string, params: {[key: string]: any} = {}, method: string = 'GET'): Promise { let req = { - uri: this._config.uri + uri + '?access_token=' + this._config.token, + uri: new URL(uri + '?access_token=' + this._config.token, this._config.uri), headers: { 'content-type': 'application/json' }, From 05ad8628dfd932f4c84358c877894b339490806e Mon Sep 17 00:00:00 2001 From: Lord Rasta Date: Fri, 31 May 2019 14:31:10 +0200 Subject: [PATCH 2/2] Change to url legacy due ts --- packages/botkit-plugin-cms/src/cms.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/botkit-plugin-cms/src/cms.ts b/packages/botkit-plugin-cms/src/cms.ts index 73fa8c66b..16da585c6 100644 --- a/packages/botkit-plugin-cms/src/cms.ts +++ b/packages/botkit-plugin-cms/src/cms.ts @@ -8,6 +8,7 @@ import { Botkit, BotkitDialogWrapper, BotkitMessage, BotWorker, BotkitConversation } from 'botkit'; import * as request from 'request'; +const url = require('url'); const debug = require('debug')('botkit:cms'); /** @@ -70,7 +71,7 @@ export class BotkitCMSHelper { private async apiRequest(uri: string, params: {[key: string]: any} = {}, method: string = 'GET'): Promise { let req = { - uri: new URL(uri + '?access_token=' + this._config.token, this._config.uri), + uri: url.resolve(this._config.uri, uri + '?access_token=' + this._config.token), headers: { 'content-type': 'application/json' },