Browse Source

chore(dynamite_end_to_end_test,nextcloud): Remove unnecessary casts

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/1143/head
jld3103 1 year ago
parent
commit
d8e6ccecff
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 2
      packages/dynamite/dynamite_end_to_end_test/lib/request_body.openapi.dart
  2. 3
      packages/nextcloud/lib/src/api/notes.openapi.dart
  3. 6
      packages/nextcloud/lib/src/webdav/client.dart
  4. 10
      packages/nextcloud/test/webdav_test.dart

2
packages/dynamite/dynamite_end_to_end_test/lib/request_body.openapi.dart

@ -117,7 +117,7 @@ class Client extends DynamiteClient {
headers['Content-Type'] = 'application/octet-stream';
if (string != null) {
body = utf8.encode(string) as Uint8List;
body = utf8.encode(string);
}
const path = '/';
final uri = Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null);

3
packages/nextcloud/lib/src/api/notes.openapi.dart

@ -676,8 +676,7 @@ class Client extends DynamiteClient {
// coverage:ignore-end
headers['Content-Type'] = 'application/json';
body = utf8.encode(json.encode(_jsonSerializers.serialize(settings, specifiedType: const FullType(Settings))))
as Uint8List;
body = utf8.encode(json.encode(_jsonSerializers.serialize(settings, specifiedType: const FullType(Settings))));
const path = '/index.php/apps/notes/api/v1/settings';
final uri = Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null);

6
packages/nextcloud/lib/src/webdav/client.dart

@ -247,7 +247,7 @@ class WebDavClient {
_constructUri(path),
data: utf8.encode(
WebDavPropfind(prop: prop ?? WebDavPropWithoutValues()).toXmlElement(namespaces: namespaces).toXmlString(),
) as Uint8List,
),
headers: depth != null ? {'Depth': depth.value} : null,
),
);
@ -270,7 +270,7 @@ class WebDavClient {
filterRules: filterRules,
prop: prop ?? WebDavPropWithoutValues(), // coverage:ignore-line
).toXmlElement(namespaces: namespaces).toXmlString(),
) as Uint8List,
),
),
);
@ -293,7 +293,7 @@ class WebDavClient {
set: set != null ? WebDavSet(prop: set) : null,
remove: remove != null ? WebDavRemove(prop: remove) : null,
).toXmlElement(namespaces: namespaces).toXmlString(),
) as Uint8List,
),
);
final data = await _parseResponse(response);
for (final a in data.responses) {

10
packages/nextcloud/test/webdav_test.dart

@ -260,7 +260,7 @@ void main() {
});
test('Get directory props', () async {
final data = utf8.encode('test') as Uint8List;
final data = utf8.encode('test');
await client.webdav.mkcol(PathUri.parse('test'));
await client.webdav.put(data, PathUri.parse('test/test.txt'));
@ -292,7 +292,7 @@ void main() {
});
test('Filter files', () async {
final response = await client.webdav.put(utf8.encode('test') as Uint8List, PathUri.parse('test.txt'));
final response = await client.webdav.put(utf8.encode('test'), PathUri.parse('test.txt'));
final id = response.headers['oc-fileid']!.first;
await client.webdav.proppatch(
PathUri.parse('test.txt'),
@ -325,7 +325,7 @@ void main() {
final uploadTime = DateTime.now();
await client.webdav.put(
utf8.encode('test') as Uint8List,
utf8.encode('test'),
PathUri.parse('test.txt'),
lastModified: lastModifiedDate,
created: createdDate,
@ -360,7 +360,7 @@ void main() {
});
test('Remove properties', () async {
await client.webdav.put(utf8.encode('test') as Uint8List, PathUri.parse('test.txt'));
await client.webdav.put(utf8.encode('test'), PathUri.parse('test.txt'));
var updated = await client.webdav.proppatch(
PathUri.parse('test.txt'),
@ -446,7 +446,7 @@ void main() {
('put_get_utf8_segment', 'res-%e2%82%ac'),
]) {
test(name, () async {
final content = utf8.encode('This is a test file') as Uint8List;
final content = utf8.encode('This is a test file');
final response = await client.webdav.put(content, PathUri.parse(path));
expect(response.statusCode, 201);

Loading…
Cancel
Save