Skip to content

Commit

Permalink
update documentation, and update field for multipart
Browse files Browse the repository at this point in the history
  • Loading branch information
arao6 committed Sep 29, 2020
1 parent 31b8a0f commit 967d5dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Changelog
=========
1.4.1
-------------------
- Add Venmo Accounts endpoints
- Add Transfer Refunds endpoint
- Add Multipart Form data upload to User

1.4.0
-------------------
Expand Down
9 changes: 5 additions & 4 deletions src/utils/ApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ export default class ApiClient {
let contentType = "multipart/form-data";
let accept = "application/json";
/* eslint-disable no-unused-vars */
const keys = Object.keys(data); // eslint-disable-line @typescript-eslint/no-unused-vars
const keys = Object.keys(data);
const values = Object.values(data);
/* eslint-enable no-unused-vars */

let requestDataPromise = new Promise((resolve) => resolve(data));
if (this.isEncrypted) {
contentType = "multipart/form-data";
Expand All @@ -133,9 +134,9 @@ export default class ApiClient {
.set("User-Agent", `Hyperwallet Node SDK v${this.version}`)
.type(contentType)
.accept(accept)
.field("data", JSON.stringify(values[0]))
.attach(JSON.stringify(keys[1]), values[1])
.attach(JSON.stringify(keys[2]), values[2])
.field(keys[0], JSON.stringify(values[0]))
.attach(keys[1], values[1])
.attach(keys[2], values[2])
.end(this.wrapCallback("PUT", callback));
}).catch((err) => callback(err, undefined, undefined));
}
Expand Down

0 comments on commit 967d5dc

Please sign in to comment.