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

Commit 825230a

Browse files
committed
Merge pull request #26 from jhuckabee/easy-params-override
Allow easy override of params setup for components that extend from core-ajax
2 parents b960913 + 369ab3e commit 825230a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

core-ajax.html

+9-4
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,14 @@
347347
}
348348
},
349349

350+
getParams: function(params) {
351+
params = this.params || params;
352+
if (params && typeof(params) == 'string') {
353+
params = JSON.parse(params);
354+
}
355+
return params;
356+
},
357+
350358
/**
351359
* Performs an Ajax request to the specified URL.
352360
*
@@ -356,10 +364,7 @@
356364
var args = this.xhrArgs || {};
357365
// TODO(sjmiles): we may want XHR to default to POST if body is set
358366
args.body = this.body || args.body;
359-
args.params = this.params || args.params;
360-
if (args.params && typeof(args.params) == 'string') {
361-
args.params = JSON.parse(args.params);
362-
}
367+
args.params = this.getParams(args.params);
363368
args.headers = this.headers || args.headers || {};
364369
if (args.headers && typeof(args.headers) == 'string') {
365370
args.headers = JSON.parse(args.headers);

0 commit comments

Comments
 (0)