Skip to content

Commit

Permalink
rebase onto master and fix mergedata
Browse files Browse the repository at this point in the history
  • Loading branch information
eshanholtz committed Mar 16, 2020
1 parent 449b484 commit 2ed4bb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/client/src/classes/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Client {
createHeaders(data) {

//Merge data with default headers
let headers = mergeData(this.defaultHeaders, data);
const headers = mergeData(this.defaultHeaders, data);

//Add API key, but don't overwrite if header already set
if (typeof headers.Authorization === 'undefined' && this.apiKey) {
Expand All @@ -91,9 +91,9 @@ class Client {
createRequest(opts) {

let options = {
url: opts.url || opts.uri,
baseURL: opts.baseURL || this.defaultRequest.baseURL,
method: opts.method || this.defaultRequest.method,
url: opts.uri || opts.url,
baseURL: opts.baseURL,
method: opts.method,
data: opts.data ? opts.data : opts.body ? opts.body : {},
params: opts.qs ? opts.qs : opts.params ? opts.params : {},
headers: opts.headers || {},
Expand Down
6 changes: 2 additions & 4 deletions packages/helpers/helpers/merge-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ module.exports = function mergeData(base, data) {
if (data.hasOwnProperty(key)) {
if (data[key] && Array.isArray(data[key])) {
merged[key] = data[key];
}
else if (data[key] && typeof data[key] === 'object') {
} else if (data[key] && typeof data[key] === 'object') {
merged[key] = Object.assign({}, data[key]);
}
else {
} else if (data[key]) {
merged[key] = data[key];
}
}
Expand Down

0 comments on commit 2ed4bb9

Please sign in to comment.