diff options
author | Stevo Slavic <sslavic@gmail.com> | 2014-06-25 13:06:53 +0400 |
---|---|---|
committer | Stevo Slavic <sslavic@gmail.com> | 2014-06-25 13:06:53 +0400 |
commit | 418ae87c3743b57410a0c0ab8d6e33deb1b9b395 (patch) | |
tree | f189ddccf0b62be9a190892ce0b7ce73060ff917 /js | |
parent | ae6a2fb5ec8b562bd505d227a0661944eeec9ddb (diff) |
Made default request method and default request content type DRY
Diffstat (limited to 'js')
-rw-r--r-- | js/piwik.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/js/piwik.js b/js/piwik.js index cad614a2b6..b34a6a42b6 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -1078,11 +1078,15 @@ if (typeof Piwik !== 'object') { enableJSErrorTracking = false, + defaultRequestMethod = 'GET', + // Request method (GET or POST) - configRequestMethod = 'GET', + configRequestMethod = defaultRequestMethod, + + defaultRequestContentType = 'application/x-www-form-urlencoded; charset=UTF-8', // Request Content-Type header value; applicable when POST request method is used for submitting tracking events - configRequestContentType = 'application/x-www-form-urlencoded; charset=UTF-8', + configRequestContentType = defaultRequestContentType, // Tracker URL configTrackerUrl = trackerUrl || '', @@ -2618,7 +2622,7 @@ if (typeof Piwik !== 'object') { * @param string method GET or POST; default is GET */ setRequestMethod: function (method) { - configRequestMethod = method || 'GET'; + configRequestMethod = method || defaultRequestMethod; }, /** @@ -2629,7 +2633,7 @@ if (typeof Piwik !== 'object') { * @param string requestContentType; default is 'application/x-www-form-urlencoded; charset=UTF-8' */ setRequestContentType: function (requestContentType) { - configRequestContentType = requestContentType || 'application/x-www-form-urlencoded; charset=UTF-8'; + configRequestContentType = requestContentType || defaultRequestContentType; }, /** |