dart-lang / http

A composable API for making HTTP requests in Dart.
https://pub.dev/packages/http
BSD 3-Clause "New" or "Revised" License
1.02k stars 353 forks source link

randomly missing commas and quotes from response json #1216

Open bagusindrayana opened 4 months ago

bagusindrayana commented 4 months ago

i try to GET request to rest api with HttpClient, http or dio and always get FormatException when try to decode the response only if using emulator and if data is big, like 5 mb json data or thousand of row, i try in real device and didn't experience any problems.

here example from Exception result, there comma and quotes missing in in several position and always change every request even is same endpoint and same data

first request image

second request image

third request image

i also try to log the string response and try to validate with jsonlint and there always missing comma or quotes

package version : http: ^1.2.0 dio: ^5.4.3+1

flutter doctor : [√] Flutter (Channel stable, 3.16.9, on Microsoft Windows [Version 10.0.22631.3447], locale en-ID) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.0) [√] Android Studio (version 2022.2) [√] Android Studio (version 2023.3) [√] VS Code (version 1.89.1) [√] Connected device (4 available) [√] Network resources

my code :

var url = Uri.parse(baseUrl + '/asset');
var response = await http.get(url);
dynamic responseData = jsonDecode(response.body.toString());
brianquinlan commented 2 months ago

Hi @bagusindrayana ,

Would you provide a reproducible example?