Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added support for application/json body #968

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/base/RequestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
15 changes: 15 additions & 0 deletions src/rest/PreviewMessaging.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import PreviewMessagingBase from "./PreviewMessagingBase";

Check failure on line 1 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (14)

Cannot find module './PreviewMessagingBase' or its corresponding type declarations.

Check failure on line 1 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (16)

Cannot find module './PreviewMessagingBase' or its corresponding type declarations.

Check failure on line 1 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (18)

Cannot find module './PreviewMessagingBase' or its corresponding type declarations.

Check failure on line 1 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (lts/*)

Cannot find module './PreviewMessagingBase' or its corresponding type declarations.

Check failure on line 1 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (14)

Cannot find module './PreviewMessagingBase' or its corresponding type declarations.

Check failure on line 1 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (lts/*)

Cannot find module './PreviewMessagingBase' or its corresponding type declarations.
import {MessageListInstance} from "./previewMessaging/v1/message";

Check failure on line 2 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (14)

Cannot find module './previewMessaging/v1/message' or its corresponding type declarations.

Check failure on line 2 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (16)

Cannot find module './previewMessaging/v1/message' or its corresponding type declarations.

Check failure on line 2 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (18)

Cannot find module './previewMessaging/v1/message' or its corresponding type declarations.

Check failure on line 2 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (lts/*)

Cannot find module './previewMessaging/v1/message' or its corresponding type declarations.

Check failure on line 2 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (14)

Cannot find module './previewMessaging/v1/message' or its corresponding type declarations.

Check failure on line 2 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (lts/*)

Cannot find module './previewMessaging/v1/message' or its corresponding type declarations.

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;

Check failure on line 12 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (14)

Property 'v1' does not exist on type 'PreviewMessaging'.

Check failure on line 12 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (16)

Property 'v1' does not exist on type 'PreviewMessaging'.

Check failure on line 12 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (18)

Property 'v1' does not exist on type 'PreviewMessaging'.

Check failure on line 12 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (lts/*)

Property 'v1' does not exist on type 'PreviewMessaging'.

Check failure on line 12 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (14)

Property 'v1' does not exist on type 'PreviewMessaging'.

Check failure on line 12 in src/rest/PreviewMessaging.ts

View workflow job for this annotation

GitHub Actions / Test (lts/*)

Property 'v1' does not exist on type 'PreviewMessaging'.
}
}
export = PreviewMessaging
Loading