aboutsummaryrefslogtreecommitdiffstats
path: root/lib/webcals
diff options
context:
space:
mode:
authorJames Lal <james@lightsofapollo.com>2012-06-26 12:29:36 +0200
committerJames Lal <james@lightsofapollo.com>2012-06-26 12:29:36 +0200
commit95fe95710b81d14dda2a3b77281f1fe65f703ef3 (patch)
tree0ae6cf64a9d93ea7d6034e359433d1412f0f0aff /lib/webcals
parent816243091b923cc64d87250f8cbd0854a1348312 (diff)
downloadjsCalDAV-95fe95710b81d14dda2a3b77281f1fe65f703ef3.tar.gz
add user/pass options to abstract request
Diffstat (limited to 'lib/webcals')
-rw-r--r--lib/webcals/request/abstract.js22
-rw-r--r--lib/webcals/xhr.js1
2 files changed, 19 insertions, 4 deletions
diff --git a/lib/webcals/request/abstract.js b/lib/webcals/request/abstract.js
index ac0ceb5..4d549c2 100644
--- a/lib/webcals/request/abstract.js
+++ b/lib/webcals/request/abstract.js
@@ -11,13 +11,29 @@
* @param {Object} options additional options for request.
*/
function Abstract(url, options) {
+ if (typeof(options) === 'undefined') {
+ options = {};
+ }
+
var key;
+ var xhrOptions = {};
if (typeof(url) === 'undefined' || !url) {
throw new Error('request requires a url');
}
- this.url = url;
+ xhrOptions.url = url;
+
+ if ('password' in options) {
+ xhrOptions.password = options.password;
+ delete options.password;
+ }
+
+ if ('user' in options) {
+ xhrOptions.user = options.user;
+ delete options.user;
+ }
+
this.sax = new SAX();
for (key in options) {
@@ -26,9 +42,7 @@
}
}
- this.xhr = new XHR({
- url: this.url
- });
+ this.xhr = new XHR(xhrOptions);
}
Abstract.prototype = {
diff --git a/lib/webcals/xhr.js b/lib/webcals/xhr.js
index f20415f..a8d8d58 100644
--- a/lib/webcals/xhr.js
+++ b/lib/webcals/xhr.js
@@ -49,6 +49,7 @@
waiting: false,
user: null,
password: null,
+ url: null,
headers: {},
data: {},