catto.js 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AuthClient.js CHANGED
@@ -42,13 +42,16 @@ module.exports = class {
42
42
  try {
43
43
  var result = await request.post({
44
44
  "url": "https://discord.com/api/oauth2/token",
45
- "form": {
45
+ "headers": {
46
+ "Content-Type": "application/x-www-form-urlencoded"
47
+ },
48
+ "body": new URLSearchParams({
46
49
  "client_id": this.options.id,
47
50
  "client_secret": this.options.secret,
48
51
  "grant_type": "authorization_code",
49
52
  "code": req.query.code,
50
53
  "redirect_uri": this.redirectUri
51
- }
54
+ })
52
55
  });
53
56
  } catch(e) {
54
57
  return !1;
@@ -67,12 +70,15 @@ module.exports = class {
67
70
  try {
68
71
  var result = await request.post({
69
72
  "url": "https://discord.com/api/oauth2/token",
70
- "form": {
73
+ "headers": {
74
+ "Content-Type": "application/x-www-form-urlencoded"
75
+ },
76
+ "body": new URLSearchParams({
71
77
  "client_id": this.options.id,
72
78
  "client_secret": this.options.secret,
73
79
  "grant_type": "refresh_token",
74
80
  "refreshToken": this.options.refreshToken
75
- }
81
+ })
76
82
  });
77
83
  } catch(e) {
78
84
  return !1;
@@ -91,11 +97,14 @@ module.exports = class {
91
97
  try {
92
98
  var result = await request.post({
93
99
  "url": "https://discord.com/api/oauth2/token/revoke",
94
- "form": {
100
+ "headers": {
101
+ "Content-Type": "application/x-www-form-urlencoded"
102
+ },
103
+ "body": new URLSearchParams({
95
104
  "client_id": this.options.id,
96
105
  "client_secret": this.options.secret,
97
106
  "token": this.options.accessToken
98
- }
107
+ })
99
108
  });
100
109
  } catch(e) {
101
110
  return !1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catto.js",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Universal module for everything.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/request.js CHANGED
@@ -12,6 +12,11 @@ if (globalThis.fetch && typeof fetch === "undefined") {
12
12
  }
13
13
 
14
14
  function wrap(method, options) {
15
+ if (typeof options === "string") {
16
+ options = {
17
+ "url": options
18
+ };
19
+ }
15
20
  var options2 = Object.assign({}, options);
16
21
  var url = options2.url;
17
22
  delete options2.url;