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

Commit

Permalink
Allow easy override of params in components that extend core-ajax.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhuckabee committed Sep 16, 2014
1 parent 0898920 commit 369ab3e
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 @@ -286,6 +286,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 @@ -295,10 +303,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 369ab3e

Please sign in to comment.