Repository navigation
refactor: Add httpClientOverride parameter to ServerpodClientShared - #5134
Merged
vfiruz97 merged 5 commits intoMay 18, 2026
Conversation
vfiruz97
requested review from
marcelomendoncasoares and
nielsenko
and removed request for
nielsenko
May 14, 2026 14:27
nielsenko
approved these changes
May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Adds an optional
http.Client? httpClientOverrideparameter toServerpodClientSharedand all generated client constructors.If no override is provided the default
http.Client()is used on web and anIOClient(wrappingdart:io'sHttpClient) is used on native. If an override is provided it is used directly, giving users full control over the underlying HTTP transport.This allows passing any
http.Clientimplementation — including platform-native clients from packages such as cupertino_http (NSURLSession on iOS/macOS) or cronet_http (Cronet on Android), as well as configuring browser-specific behaviour on web.Examples:
Enable CORS credentials on web:
Use platform-native HTTP on iOS/macOS ([cupertino_http]):
Use Cronet on Android ([cronet_http]):
Note:
httpClientOverrideandsecurityContextcannot be set simultaneously — an assertion enforces this since securityContext is only meaningful when the framework builds the client internally.Fixes #4850
Pre-launch Checklist
///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.If you need help, consider asking for advice on the discussion board.
Breaking changes
No breaking changes.