-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
This happens when we're running a flutter app on iOS with cx_flutter_plugin. It looks like response_content_length is being sent as a String from Android native side while on iOS, it is being sent as an int while trying to parse NetworkRequestContext.
We forked the package and are using the following hot-fix in the meantime, though it should probably be fixed on the platform channel level.
factory NetworkRequestContext.fromJson(Map<String, dynamic> json) {
return NetworkRequestContext(
method: json['method'] as String,
statusCode:
json['status_code'] is String ? int.tryParse(json['status_code'] as String) ?? 0 : json['status_code'] as int,
url: json['url'] as String,
fragments: json['fragments'] as String?,
host: json['host'] as String?,
schema: json['schema'] as String?,
statusText: json['status_text'] as String?,
- responseContentLength: json['response_content_length'] as String?,
+ responseContentLength: switch (json['response_content_length']) {
+ String s => s,
+ int i => i.toString(),
+ null => null,
+ _ => '0'
+ },
duration:
json['duration'] is String ? int.tryParse(json['duration'] as String) ?? 0 : json['duration'] as int? ?? 0,
);
}
Metadata
Metadata
Assignees
Labels
No labels