//
// SPDX-License-Identifier: AGPL-3.0
-import { customEncodeURI, encodeHash } from "./url";
+import { customEncodeURI } from "./url";
export class WebDAV {
? this.defaults.baseURL+'/'
: ''}${customEncodeURI(config.url)}`);
- if (config.headers && config.headers.Destination) {
- config.headers.Destination = encodeHash(config.headers.Destination);
- }
-
const headers = { ...this.defaults.headers, ...config.headers };
Object
.keys(headers)
.forEach(key => r.setRequestHeader(key, headers[key]));
+ if (!(window as any).cancelTokens) {
+ Object.assign(window, { cancelTokens: {} });
+ }
+
+ (window as any).cancelTokens[config.url] = () => {
+ resolve(r);
+ r.abort();
+ }
+
if (config.onUploadProgress) {
r.upload.addEventListener('progress', config.onUploadProgress);
}