Skip to content

Commit

Permalink
refactor: set userAgent for HttpClient in case of proxyAwareConnection (
Browse files Browse the repository at this point in the history
  • Loading branch information
bassam-deriv authored Apr 3, 2024
1 parent 8f6dc0b commit 66a87de
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/services/connection/api_manager/binary_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ class BinaryAPI extends BaseAPI {
final String proxy = await FlutterSystemProxy.findProxyFromEnvironment(
uri.toString().replaceAll('wss', 'https'));

client = HttpClient()..findProxy = (Uri uri) => proxy;
client = HttpClient()
..userAgent = WebSocket.userAgent
..findProxy = (Uri uri) => proxy;
}

// Initialize connection to websocket server.
Expand Down Expand Up @@ -139,8 +141,10 @@ class BinaryAPI extends BaseAPI {
}

@override
Future<T> call<T>(
{required Request request, List<String> nullableKeys = const <String>[],}) async {
Future<T> call<T>({
required Request request,
List<String> nullableKeys = const <String>[],
}) async {
final Response response = await (_callManager ??= CallManager(this))(
request: request,
nullableKeys: nullableKeys,
Expand Down

0 comments on commit 66a87de

Please sign in to comment.