mailgun.js 4.1.0 → 4.1.1

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.
@@ -4,4 +4,4 @@
4
4
 
5
5
  /*! https://mths.be/punycode v1.3.2 by @mathias */
6
6
 
7
- /*! mailgun.js v4.0.1 */
7
+ /*! mailgun.js v4.1.0 */
package/lib/ip-pools.ts CHANGED
@@ -16,12 +16,12 @@ export default class IpPoolsClient {
16
16
  }
17
17
 
18
18
  create(data: { name: string, description?: string, ips?: string[] }) {
19
- return this.request.post('/v1/ip_pools', data)
19
+ return this.request.postWithFD('/v1/ip_pools', data)
20
20
  .then((response: { body: { message: string, pool_id: string } }) => response?.body);
21
21
  }
22
22
 
23
23
  update(poolId: string, data: IpPoolUpdateData) : Promise<any> {
24
- return this.request.patch(`/v1/ip_pools/${poolId}`, data)
24
+ return this.request.patchWithFD(`/v1/ip_pools/${poolId}`, data)
25
25
  .then((response: { body: any }) => response?.body);
26
26
  }
27
27
 
package/lib/request.ts CHANGED
@@ -165,6 +165,17 @@ class Request {
165
165
  return this.command('put', url, formData, params);
166
166
  }
167
167
 
168
+ patchWithFD(url: string, data: any): Promise<APIResponse> {
169
+ if (!data) {
170
+ throw new Error('Please provide data object');
171
+ }
172
+ const params: any = {
173
+ headers: { 'Content-Type': null }
174
+ };
175
+ const formData = this.createFormData(data);
176
+ return this.command('patch', url, formData, params);
177
+ }
178
+
168
179
  createFormData(data: any): NodeFormData | FormData {
169
180
  const formData: NodeFormData | FormData = Object.keys(data)
170
181
  .filter(function (key) { return data[key]; })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mailgun.js",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "main": "dist/mailgun.node.js",
5
5
  "browser": "dist/mailgun.web.js",
6
6
  "types": "dist/index.d.ts",