|
1 | 1 | // ignore_for_file: non_constant_identifier_names
|
2 | 2 |
|
3 | 3 | import 'dart:async';
|
4 |
| -import 'dart:convert'; |
5 | 4 | import 'dart:typed_data';
|
6 | 5 |
|
7 | 6 | import 'package:http/http.dart' as http;
|
@@ -62,23 +61,41 @@ class WebDavClient {
|
62 | 61 |
|
63 | 62 | /// Returns a request to create a collection at [path].
|
64 | 63 | ///
|
| 64 | + /// The props in [set] will be added. |
| 65 | + /// |
65 | 66 | /// See:
|
66 |
| - /// * http://www.webdav.org/specs/rfc2518.html#METHOD_MKCOL for more information. |
| 67 | + /// * http://www.webdav.org/specs/rfc2518.html#METHOD_MKCOL and http://www.webdav.org/specs/rfc5689.html for more information. |
67 | 68 | /// * [mkcol] for a complete operation executing this request.
|
68 |
| - http.Request mkcol_Request(PathUri path) { |
| 69 | + http.Request mkcol_Request( |
| 70 | + PathUri path, { |
| 71 | + WebDavProp? set, |
| 72 | + }) { |
69 | 73 | final request = http.Request('MKCOL', _constructUri(path));
|
| 74 | + if (set != null) { |
| 75 | + request.body = WebDavMkcol( |
| 76 | + set: WebDavSet(prop: set), |
| 77 | + ).toXmlElement(namespaces: namespaces).toXmlString(); |
| 78 | + } |
70 | 79 |
|
71 | 80 | _addBaseHeaders(request);
|
72 | 81 | return request;
|
73 | 82 | }
|
74 | 83 |
|
75 | 84 | /// Creates a collection at [path].
|
76 | 85 | ///
|
| 86 | + /// The props in [set] will be added. |
| 87 | + /// |
77 | 88 | /// See:
|
78 |
| - /// * http://www.webdav.org/specs/rfc2518.html#METHOD_MKCOL for more information. |
| 89 | + /// * http://www.webdav.org/specs/rfc2518.html#METHOD_MKCOL and http://www.webdav.org/specs/rfc5689.html for more information. |
79 | 90 | /// * [mkcol_Request] for the request sent by this method.
|
80 |
| - Future<http.StreamedResponse> mkcol(PathUri path) { |
81 |
| - final request = mkcol_Request(path); |
| 91 | + Future<http.StreamedResponse> mkcol( |
| 92 | + PathUri path, { |
| 93 | + WebDavProp? set, |
| 94 | + }) { |
| 95 | + final request = mkcol_Request( |
| 96 | + path, |
| 97 | + set: set, |
| 98 | + ); |
82 | 99 |
|
83 | 100 | return csrfClient.send(request);
|
84 | 101 | }
|
@@ -412,7 +429,6 @@ class WebDavClient {
|
412 | 429 | WebDavDepth? depth,
|
413 | 430 | }) {
|
414 | 431 | final request = http.Request('PROPFIND', _constructUri(path))
|
415 |
| - ..encoding = utf8 |
416 | 432 | ..body = WebDavPropfind(prop: prop ?? const WebDavPropWithoutValues())
|
417 | 433 | .toXmlElement(namespaces: namespaces)
|
418 | 434 | .toXmlString();
|
@@ -461,7 +477,6 @@ class WebDavClient {
|
461 | 477 | WebDavPropWithoutValues? prop,
|
462 | 478 | }) {
|
463 | 479 | final request = http.Request('REPORT', _constructUri(path))
|
464 |
| - ..encoding = utf8 |
465 | 480 | ..body = WebDavOcFilterFiles(
|
466 | 481 | filterRules: filterRules,
|
467 | 482 | prop: prop ?? const WebDavPropWithoutValues(), // coverage:ignore-line
|
@@ -508,7 +523,6 @@ class WebDavClient {
|
508 | 523 | WebDavPropWithoutValues? remove,
|
509 | 524 | }) {
|
510 | 525 | final request = http.Request('PROPPATCH', _constructUri(path))
|
511 |
| - ..encoding = utf8 |
512 | 526 | ..body = WebDavPropertyupdate(
|
513 | 527 | set: set != null ? WebDavSet(prop: set) : null,
|
514 | 528 | remove: remove != null ? WebDavRemove(prop: remove) : null,
|
|
0 commit comments