Skip to content
Snippets Groups Projects
Commit 7b0f83b6 authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #22445 from owncloud/files-client-sendpropfindheaders

Files DAV client send propfind headers
parents 92e51600 5575443b
No related branches found
No related tags found
No related merge requests found
...@@ -394,7 +394,6 @@ ...@@ -394,7 +394,6 @@
properties = options.properties; properties = options.properties;
} }
// TODO: headers
this._client.propFind( this._client.propFind(
this._buildUrl(path), this._buildUrl(path),
properties, properties,
...@@ -441,7 +440,6 @@ ...@@ -441,7 +440,6 @@
throw 'Missing filter argument'; throw 'Missing filter argument';
} }
var headers = _.extend({}, this._defaultHeaders);
// root element with namespaces // root element with namespaces
var body = '<oc:filter-files '; var body = '<oc:filter-files ';
var namespace; var namespace;
...@@ -472,7 +470,7 @@ ...@@ -472,7 +470,7 @@
this._client.request( this._client.request(
'REPORT', 'REPORT',
this._buildUrl(), this._buildUrl(),
headers, {},
body body
).then(function(result) { ).then(function(result) {
if (self._isSuccessStatus(result.status)) { if (self._isSuccessStatus(result.status)) {
...@@ -542,8 +540,7 @@ ...@@ -542,8 +540,7 @@
this._client.request( this._client.request(
'GET', 'GET',
this._buildUrl(path), this._buildUrl(path)
this._defaultHeaders
).then( ).then(
function(result) { function(result) {
if (self._isSuccessStatus(result.status)) { if (self._isSuccessStatus(result.status)) {
...@@ -575,7 +572,7 @@ ...@@ -575,7 +572,7 @@
var deferred = $.Deferred(); var deferred = $.Deferred();
var promise = deferred.promise(); var promise = deferred.promise();
options = options || {}; options = options || {};
var headers = _.extend({}, this._defaultHeaders); var headers = {};
var contentType = 'text/plain;charset=utf-8'; var contentType = 'text/plain;charset=utf-8';
if (options.contentType) { if (options.contentType) {
contentType = options.contentType; contentType = options.contentType;
...@@ -616,8 +613,7 @@ ...@@ -616,8 +613,7 @@
this._client.request( this._client.request(
method, method,
this._buildUrl(path), this._buildUrl(path)
this._defaultHeaders
).then( ).then(
function(result) { function(result) {
if (self._isSuccessStatus(result.status)) { if (self._isSuccessStatus(result.status)) {
...@@ -673,10 +669,9 @@ ...@@ -673,10 +669,9 @@
var self = this; var self = this;
var deferred = $.Deferred(); var deferred = $.Deferred();
var promise = deferred.promise(); var promise = deferred.promise();
var headers = var headers = {
_.extend({ 'Destination' : this._buildUrl(destinationPath)
'Destination' : this._buildUrl(destinationPath) };
}, this._defaultHeaders);
if (!allowOverwrite) { if (!allowOverwrite) {
headers['Overwrite'] = 'F'; headers['Overwrite'] = 'F';
......
...@@ -40,18 +40,19 @@ dav.Client.prototype = { ...@@ -40,18 +40,19 @@ dav.Client.prototype = {
* *
* @param {string} url Url to do the propfind request on * @param {string} url Url to do the propfind request on
* @param {Array} properties List of properties to retrieve. * @param {Array} properties List of properties to retrieve.
* @param {Object} [headers] headers
* @return {Promise} * @return {Promise}
*/ */
propFind : function(url, properties, depth) { propFind : function(url, properties, depth, headers) {
if(typeof depth == "undefined") { if(typeof depth == "undefined") {
depth = 0; depth = 0;
} }
var headers = { headers = headers || {};
Depth : depth,
'Content-Type' : 'application/xml; charset=utf-8' headers['Depth'] = depth;
}; headers['Content-Type'] = 'application/xml; charset=utf-8';
var body = var body =
'<?xml version="1.0"?>\n' + '<?xml version="1.0"?>\n' +
...@@ -103,6 +104,7 @@ dav.Client.prototype = { ...@@ -103,6 +104,7 @@ dav.Client.prototype = {
* *
* @param {string} url Url to do the proppatch request on * @param {string} url Url to do the proppatch request on
* @param {Array} properties List of properties to store. * @param {Array} properties List of properties to store.
* @param {Object} [headers] headers
* @return {Promise} * @return {Promise}
*/ */
propPatch : function(url, properties, headers) { propPatch : function(url, properties, headers) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment