From e31953c5c37ca03c49fb1953b9bf3703b6e1a690 Mon Sep 17 00:00:00 2001 From: Mohsin Sheikh Date: Tue, 27 Jul 2021 14:18:32 +0500 Subject: [PATCH 1/2] Added 'raw_json' param to api calls. Fixes issues with encoded URIs and gives way more data with each call. --- lib/src/reddit.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/src/reddit.dart b/lib/src/reddit.dart index e9e3048..d612bf2 100644 --- a/lib/src/reddit.dart +++ b/lib/src/reddit.dart @@ -620,6 +620,7 @@ class Reddit { 'Cannot make requests using unauthenticated client.'); } final path = Uri.https(defaultOAuthApiEndpoint, api); + params ??= {'raw_json': '1'}; // only on null final response = await auth.get(path, params: params, followRedirects: followRedirects); return objectify ? _objector.objectify(response) : response; From a0f0f05c21fdbfbf1f6ff6d2e4344f2a303f9281 Mon Sep 17 00:00:00 2001 From: Mohsin Sheikh <29257166+SupremeDeity@users.noreply.github.com> Date: Tue, 27 Jul 2021 17:18:23 +0500 Subject: [PATCH 2/2] Param 'raw_json' un-overridable. Param 'raw_json' will be applied, regardless of whether params are already passed or not. --- lib/src/reddit.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/src/reddit.dart b/lib/src/reddit.dart index d612bf2..018c089 100644 --- a/lib/src/reddit.dart +++ b/lib/src/reddit.dart @@ -620,7 +620,8 @@ class Reddit { 'Cannot make requests using unauthenticated client.'); } final path = Uri.https(defaultOAuthApiEndpoint, api); - params ??= {'raw_json': '1'}; // only on null + params ??= {}; + params['raw_json'] = '1'; final response = await auth.get(path, params: params, followRedirects: followRedirects); return objectify ? _objector.objectify(response) : response;