amplify-flutter icon indicating copy to clipboard operation
amplify-flutter copied to clipboard

chore(smithy): Allow HTTP client overrides at the client constructor level

Open dnys1 opened this issue 3 years ago • 1 comments

Depends on #2124.

Allows overriding the HTTP client once when constructing an SDK client. Before, it required passing it to every call on the SDK client.

Before:

final httpClient = HttpClient.v1();

final client = S3Client(
  region: 'us-west-2',
  s3ClientConfig: const S3ClientConfig(),
  credentialsProvider: const AWSCredentialsProvider.environment(),
);

final listObjects = await client.listObjectsV2(
  ListObjectsV2Request(bucket: 'bucket'),
  client: httpClient, // Client is passed each time
);

final anotherCall = await client.getBucketLocation(
  GetBucketLocationRequest(bucket: 'bucket'),
  client: httpClient, // Client is passed each time
);

After:

final httpClient = HttpClient.v1();

final client = S3Client(
  region: 'us-west-2',
  s3ClientConfig: const S3ClientConfig(),
  credentialsProvider: const AWSCredentialsProvider.environment(),
  client: httpClient, // Client is passed once
);

final listObjects = await client.listObjectsV2(
  ListObjectsV2Request(bucket: 'bucket'),
);

final anotherCall = await client.getBucketLocation(
  GetBucketLocationRequest(bucket: 'bucket'),
);

Also re-generates goldens/auth pkg SDK.

dnys1 avatar Sep 21 '22 21:09 dnys1

Codecov Report

Merging #2151 (cfb5004) into next (6a9c132) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             next    #2151   +/-   ##
=======================================
  Coverage   42.90%   42.90%           
=======================================
  Files         115      115           
  Lines        7505     7505           
=======================================
  Hits         3220     3220           
  Misses       4285     4285           
Flag Coverage Δ
android-unit-tests ∅ <ø> (∅)
flutter-unit-tests 25.09% <ø> (ø)
ios-unit-tests 89.08% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

codecov-commenter avatar Sep 21 '22 22:09 codecov-commenter