aboutsummaryrefslogtreecommitdiffstats
path: root/lib/webcals/request
diff options
context:
space:
mode:
Diffstat (limited to 'lib/webcals/request')
-rw-r--r--lib/webcals/request/abstract.js4
-rw-r--r--lib/webcals/request/propfind.js12
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/webcals/request/abstract.js b/lib/webcals/request/abstract.js
index c90b960..de159b6 100644
--- a/lib/webcals/request/abstract.js
+++ b/lib/webcals/request/abstract.js
@@ -51,7 +51,7 @@
return '';
},
- _processResult: function(callback, req) {
+ _processResult: function(req, callback) {
callback.call(this, null, this.sax.root, req);
},
@@ -73,7 +73,7 @@
if (xhr.status > 199 && xhr.status < 300) {
// success
self.sax.write(xhr.responseText).close();
- self._processResult(callback, req);
+ self._processResult(req, callback);
} else {
// fail
callback(new Error('http error code: ' + xhr.status));
diff --git a/lib/webcals/request/propfind.js b/lib/webcals/request/propfind.js
index 9e06b49..d73530c 100644
--- a/lib/webcals/request/propfind.js
+++ b/lib/webcals/request/propfind.js
@@ -42,6 +42,18 @@
_createPayload: function() {
var content = this.template.tag('prop', this._props.join(''));
return this.template.render(content);
+ },
+
+ _processResult: function(req, callback) {
+ if ('multistatus' in this.sax.root) {
+ callback(null, this.sax.root.multistatus, req);
+ } else {
+ //XXX: Improve error handling
+ callback(
+ new Error('unexpected xml result'),
+ this.sax.root, req
+ );
+ }
}
};