Skip to content

Commit

Permalink
Provide an example of configuring IOClient with an HttpClient. (#1074)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianquinlan authored Dec 7, 2023
1 parent cd748b6 commit db7f165
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkgs/http/lib/src/io_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ class IOClient extends BaseClient {
/// The underlying `dart:io` HTTP client.
HttpClient? _inner;

/// Create a new `dart:io`-based HTTP [Client].
///
/// If [inner] is provided then it can be used to provide configuration
/// options for the client.
///
/// For example:
/// ```dart
/// final httpClient = HttpClient()
/// ..userAgent = 'Book Agent'
/// ..idleTimeout = const Duration(seconds: 5);
/// final client = IOClient(httpClient);
/// ```
IOClient([HttpClient? inner]) : _inner = inner ?? HttpClient();

/// Sends an HTTP request and asynchronously returns the response.
Expand Down

0 comments on commit db7f165

Please sign in to comment.