Skip to content

Commit

Permalink
chore(dynamite_end_to_end_test,nextcloud): Remove unnecessary casts
Browse files Browse the repository at this point in the history
Signed-off-by: jld3103 <[email protected]>
  • Loading branch information
provokateurin committed Nov 16, 2023
1 parent 42e305b commit d8e6cce
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions packages/nextcloud/lib/src/api/notes.openapi.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions packages/nextcloud/lib/src/webdav/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
);
Expand All @@ -270,7 +270,7 @@ class WebDavClient {
filterRules: filterRules,
prop: prop ?? WebDavPropWithoutValues(), // coverage:ignore-line
).toXmlElement(namespaces: namespaces).toXmlString(),
) as Uint8List,
),
),
);

Expand All @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions packages/nextcloud/test/webdav_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d8e6cce

Please sign in to comment.