diff --git a/src/base/RequestClient.ts b/src/base/RequestClient.ts index 002f2866e..f48b00b13 100644 --- a/src/base/RequestClient.ts +++ b/src/base/RequestClient.ts @@ -190,8 +190,13 @@ class RequestClient { validateStatus: (status) => status >= 100 && status < 600, }; - if (opts.data) { - options.data = qs.stringify(opts.data, { arrayFormat: "repeat" }); + if (opts.data && options.headers) { + if(options.headers["Content-Type"] === "application/x-www-form-urlencoded") { + options.data = qs.stringify(opts.data, { arrayFormat: "repeat" }); + } + else if(options.headers["Content-Type"] === "application/json") { + options.data = opts.data; + } } if (opts.params) { diff --git a/src/rest/PreviewMessaging.ts b/src/rest/PreviewMessaging.ts new file mode 100644 index 000000000..3569a2ae8 --- /dev/null +++ b/src/rest/PreviewMessaging.ts @@ -0,0 +1,15 @@ +import PreviewMessagingBase from "./PreviewMessagingBase"; +import {MessageListInstance} from "./previewMessaging/v1/message"; + +class PreviewMessaging extends PreviewMessagingBase { + /** + * @deprecated - Use v1.messages; instead + */ + get messages(): MessageListInstance { + console.warn( + "messages is deprecated. Use v1.messages; instead." + ); + return this.v1.messages; + } +} +export = PreviewMessaging