Fix: HTTP client initialization on Web by avoiding Cronet and Cupertino fallback #439
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a platform-aware http.Client factory to improve HTTP performance and behavior based on the underlying platform on issue #430 .
Changes made:
• Added createCustomClient() to return a specialized http.Client.
• Updated createDefaultHttpClient() to fallback to http.Client() if platform-specific creation fails.
• Conditional imports are used to keep the implementation cross-platform (including Web).
I’m still learning, and to be honest, I’m not very good at creating pull requests and I’m not even sure if the code is ideal. That’s why I’d really appreciate a discussion or any feedback on what’s good and what could be improved. Thank you very much.