Skip to content

Commit

Permalink
stop overwriting defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
eshanholtz committed Mar 12, 2020
1 parent dccc1fc commit ba9493b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ clean:

install: clean
npm install
npx lerna bootstrap

test: install
yarn test:files
Expand Down
3 changes: 3 additions & 0 deletions packages/client/src/classes/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ class Client {

let options = {
url: opts.url || opts.uri,
baseURL: opts.baseURL || this.defaultRequest.baseURL,
method: opts.method || this.defaultRequest.method,
data: opts.data ? opts.data : opts.body ? opts.body : {},
params: opts.qs ? opts.qs : opts.params ? opts.params : {},
headers: opts.headers || {},
};

//Merge data with empty request
Expand Down
8 changes: 5 additions & 3 deletions packages/helpers/classes/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var _ = require('lodash');
class Request {
constructor(opts) {
opts = opts || {};
this.ANY = '*'
this.ANY = '*';

this.method = opts.method || this.ANY;
this.url = opts.url || this.ANY;
Expand Down Expand Up @@ -44,7 +44,9 @@ class Request {
var params = '';
if (this.params && this.params !== this.ANY) {
params = '?' + _.join(_.chain(_.keys(this.params))
.map(function(key) { return key + '=' + this.params[key]; }.bind(this))
.map(function(key) {
return key + '=' + this.params[key];
}.bind(this))
.value(), '&');
}

Expand All @@ -64,7 +66,7 @@ class Request {
if (this.headers && this.headers !== this.ANY) {
headers = '\n' + _.join(
_.map(this.headers, function(value, key) {
return ' -H ' + key + '=' + value;
return ' -H ' + key + '=' + value;
}), '\n');
}

Expand Down

0 comments on commit ba9493b

Please sign in to comment.