Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #26 from jhuckabee/easy-params-override
Browse files Browse the repository at this point in the history
Allow easy override of params setup for components that extend from core-ajax
  • Loading branch information
garlicnation committed Jan 7, 2015
2 parents b960913 + 369ab3e commit 825230a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions core-ajax.html
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,14 @@
}
},

getParams: function(params) {
params = this.params || params;
if (params && typeof(params) == 'string') {
params = JSON.parse(params);
}
return params;
},

/**
* Performs an Ajax request to the specified URL.
*
Expand All @@ -356,10 +364,7 @@
var args = this.xhrArgs || {};
// TODO(sjmiles): we may want XHR to default to POST if body is set
args.body = this.body || args.body;
args.params = this.params || args.params;
if (args.params && typeof(args.params) == 'string') {
args.params = JSON.parse(args.params);
}
args.params = this.getParams(args.params);
args.headers = this.headers || args.headers || {};
if (args.headers && typeof(args.headers) == 'string') {
args.headers = JSON.parse(args.headers);
Expand Down

0 comments on commit 825230a

Please sign in to comment.