Skip to content

feat: respect BE network body limit #593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from

Conversation

MoKamall
Copy link
Collaborator

@MoKamall MoKamall commented Jul 3, 2025

Description of the change

Implement a size limit check for network request and response bodies to prevent excessive data logging and ensure compliance with backend size constraints.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Related issues

https://instabug.atlassian.net/browse/MOB-18486
https://instabug.atlassian.net/browse/MOB-18482

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests

Code review

  • This pull request has a descriptive title and information useful to a reviewer
  • Issue from task tracker has a link to this pull request

@InstabugCI
Copy link
Collaborator

InstabugCI commented Jul 3, 2025

Coverage Report

Label Coverage Status
Dart 83.7%

Generated by 🚫 dangerJS against fa2279f

MoKamall added 13 commits July 3, 2025 15:03
- Added `onNetworkLogBodyMaxSizeChange` method to `FeatureFlagsFlutterApi` in Dart.
- Implemented `getNetworkBodyMaxSize` method in `InstabugApi` to retrieve network log character limit.
- Updated `InstabugApiTest` with a new test for `getNetworkBodyMaxSize`.
- Updated Instabug podspec to version 15.0.1.
- Added `getNetworkBodyMaxSize` method in `InstabugApi` for retrieving network log body size.
- Introduced a new test case for `getNetworkBodyMaxSize` in `InstabugApiTests`.
- Updated .gitignore files to include project-specific and Android-related paths.
… in feature flags manager

- Added `_networkBodyMaxSize` to `FeatureFlagsManager` for managing network body size limits.
- Introduced `didRequestBodyExceedSizeLimit` and `didResponseBodyExceedSizeLimit` methods in `NetworkManager` to validate request and response body sizes against the limit.
- Created `InstabugConstants` for standardized logging messages related to network body size limits.
- Implemented caching for network body size retrieval to optimize performance.
…r.dart`

- Added early checks for request and response body size limits in `networkLogInternal`.
- Implemented truncation of request/response bodies with warning messages if size limits are exceeded.
- Logged truncation events using `InstabugLogger` for better visibility into network logging behavior.
… specific tests

- Introduced a default network body max size of 10KB to improve logging consistency.
- Updated error handling to set the cached size to the default when native API retrieval fails.
- Added unit tests for `didRequestBodyExceedSizeLimit` and `didResponseBodyExceedSizeLimit` to ensure proper size limit checks for request and response bodies.
- Changed the return type of `getNetworkBodyMaxSize` from `int?` to `double?` in the API and updated related method calls accordingly.
- Renamed `registerW3CFlagsListener` to `registerFeatureFlagsListener` for consistency across the codebase.
- Introduced a callback mechanism in `FeatureFlagsManager` to handle changes in network body max size, ensuring proper cache management in `NetworkManager`.
- Updated tests to reflect the new method names and ensure functionality remains intact.
@MoKamall MoKamall force-pushed the feat/respect-BE-network-body-limit branch from ae699ad to fa2279f Compare July 3, 2025 12:09
@MoKamall MoKamall self-assigned this Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants