Skip to content

Commit

Permalink
fix json encoding in wallabag client
Browse files Browse the repository at this point in the history
  • Loading branch information
casimir committed Aug 15, 2024
1 parent 9eedc58 commit 38fc2e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions lib/server/freon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ class FreonWallabagClient extends WallabagClient {
'Content-Type': 'application/json',
if (userAgent != null) 'User-Agent': userAgent!,
});
print('>' * 80);
print('${request.method} ${request.url}');
print(request.headers);
print((request as http.Request).body);
print('<' * 80);
final stopwatch = Stopwatch()..start();
try {
final response = await innerClient.send(request);
Expand Down
6 changes: 3 additions & 3 deletions lib/wallabag/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ extension WallabagClientEndpoints on WallabagClient {
};
final response = await post(
await buildUri('/api/entries'),
body: params.map((key, value) => MapEntry(key, value.toString())),
body: jsonEncode(params),
);
throwOnError(response);
return safeDecode(response, WallabagEntry.fromJson);
Expand All @@ -202,14 +202,14 @@ extension WallabagClientEndpoints on WallabagClient {
bool? starred,
List<String>? tags,
}) async {
var params = {
final params = {
if (archive != null) 'archive': archive ? 1 : 0,
if (starred != null) 'starred': starred ? 1 : 0,
if (tags != null) 'tags': tags.join(','),
};
final response = await patch(
await buildUri('/api/entries/$id'),
body: params.map((key, value) => MapEntry(key, value.toString())),
body: jsonEncode(params),
);
throwOnError(response);
return response;
Expand Down

0 comments on commit 38fc2e8

Please sign in to comment.