From d4b00d192896af2a851f349eedf2355cdb270c4a Mon Sep 17 00:00:00 2001 From: Jonas Ha Date: Sat, 6 Dec 2025 08:40:26 -0500 Subject: [PATCH 01/10] feat(aws-lambda): add Microsoft.Extensions.Http package reference - Added `Microsoft.Extensions.Http` to `AwsLambda.Host.csproj` for HTTP client support. - Updated `Directory.Packages.props` to include `Microsoft.Extensions.Http` version 10.0.0. --- Directory.Packages.props | 1 + src/AwsLambda.Host/AwsLambda.Host.csproj | 1 + 2 files changed, 2 insertions(+) diff --git a/Directory.Packages.props b/Directory.Packages.props index a9732615..6dd2e2ac 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -15,6 +15,7 @@ + diff --git a/src/AwsLambda.Host/AwsLambda.Host.csproj b/src/AwsLambda.Host/AwsLambda.Host.csproj index f7656c92..a479e9c5 100644 --- a/src/AwsLambda.Host/AwsLambda.Host.csproj +++ b/src/AwsLambda.Host/AwsLambda.Host.csproj @@ -18,6 +18,7 @@ + From 5438f6ab645c81364c18d2ccf87d34ddf4e7c108 Mon Sep 17 00:00:00 2001 From: Jonas Ha Date: Sat, 6 Dec 2025 08:40:33 -0500 Subject: [PATCH 02/10] feat(aws-lambda): add extensions for registering Lambda-specific HttpClients - Introduced `LambdaHttpClientServiceCollectionExtensions` for streamlined HttpClient registration. - Added methods for registering keyed HttpClient instances or factories for `ILambdaBootstrapOrchestrator`. --- ...daHttpClientServiceCollectionExtensions.cs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs diff --git a/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs b/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs new file mode 100644 index 00000000..2d548e5e --- /dev/null +++ b/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs @@ -0,0 +1,40 @@ +using Microsoft.Extensions.DependencyInjection; + +namespace AwsLambda.Host.Builder.Extensions; + +public static class LambdaHttpClientServiceCollectionExtensions +{ + extension(IServiceCollection services) + { + public IServiceCollection AddLambdaBootstrapHttpClient() + where T : HttpClient + { + ArgumentNullException.ThrowIfNull(services); + + services.AddKeyedSingleton(typeof(ILambdaBootstrapOrchestrator)); + + return services; + } + + public IServiceCollection AddLambdaBootstrapHttpClient(T client) + where T : HttpClient + { + ArgumentNullException.ThrowIfNull(services); + + services.AddKeyedSingleton(typeof(ILambdaBootstrapOrchestrator), client); + + return services; + } + + public IServiceCollection AddLambdaBootstrapHttpClient( + Func factory + ) + { + ArgumentNullException.ThrowIfNull(services); + + services.AddKeyedSingleton(typeof(ILambdaBootstrapOrchestrator), factory); + + return services; + } + } +} From a6e3c07507f6406546e83d22f4d29445a7a40e63 Mon Sep 17 00:00:00 2001 From: Jonas Ha Date: Sat, 6 Dec 2025 08:42:34 -0500 Subject: [PATCH 03/10] feat(aws-lambda): extend support for Lambda-specific HttpClient registration - Added `TryAddLambdaBootstrapHttpClient` overloads in `LambdaHttpClientServiceCollectionExtensions`. - Supported keyed singleton registration for `ILambdaBootstrapOrchestrator`. - Included method to register HttpClient instances, generics, or factories. --- ...daHttpClientServiceCollectionExtensions.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs b/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs index 2d548e5e..1af0389d 100644 --- a/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs +++ b/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; namespace AwsLambda.Host.Builder.Extensions; @@ -36,5 +37,33 @@ public IServiceCollection AddLambdaBootstrapHttpClient( return services; } + + public void TryAddLambdaBootstrapHttpClient() + where T : HttpClient + { + ArgumentNullException.ThrowIfNull(services); + + services.TryAddKeyedSingleton(typeof(ILambdaBootstrapOrchestrator)); + } + + public void TryAddLambdaBootstrapHttpClient(T client) + where T : HttpClient + { + ArgumentNullException.ThrowIfNull(services); + + services.TryAddKeyedSingleton(typeof(ILambdaBootstrapOrchestrator), client); + } + + public void TryAddLambdaBootstrapHttpClient( + Func factory + ) + { + ArgumentNullException.ThrowIfNull(services); + + services.TryAddKeyedSingleton( + typeof(ILambdaBootstrapOrchestrator), + factory + ); + } } } From 15578e3043a519d04a3f5042401aa3fbdbb8a5b1 Mon Sep 17 00:00:00 2001 From: Jonas Ha Date: Sat, 6 Dec 2025 08:51:37 -0500 Subject: [PATCH 04/10] refactor(aws-lambda): remove redundant Lambda HttpClient registration methods - Removed unused `AddLambdaBootstrapHttpClient()` and `TryAddLambdaBootstrapHttpClient()` methods. - Simplified `LambdaHttpClientServiceCollectionExtensions` to streamline HttpClient registration. --- ...bdaHttpClientServiceCollectionExtensions.cs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs b/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs index 1af0389d..82fb05a0 100644 --- a/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs +++ b/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs @@ -7,16 +7,6 @@ public static class LambdaHttpClientServiceCollectionExtensions { extension(IServiceCollection services) { - public IServiceCollection AddLambdaBootstrapHttpClient() - where T : HttpClient - { - ArgumentNullException.ThrowIfNull(services); - - services.AddKeyedSingleton(typeof(ILambdaBootstrapOrchestrator)); - - return services; - } - public IServiceCollection AddLambdaBootstrapHttpClient(T client) where T : HttpClient { @@ -38,14 +28,6 @@ public IServiceCollection AddLambdaBootstrapHttpClient( return services; } - public void TryAddLambdaBootstrapHttpClient() - where T : HttpClient - { - ArgumentNullException.ThrowIfNull(services); - - services.TryAddKeyedSingleton(typeof(ILambdaBootstrapOrchestrator)); - } - public void TryAddLambdaBootstrapHttpClient(T client) where T : HttpClient { From 3a37f9c54866815461f64f1620f2820bba513c95 Mon Sep 17 00:00:00 2001 From: Jonas Ha Date: Sat, 6 Dec 2025 08:57:01 -0500 Subject: [PATCH 05/10] refactor(aws-lambda): deprecate BootstrapHttpClient property in LambdaHostOptions - Marked `BootstrapHttpClient` as obsolete with a message pointing to alternative extension methods. - Included guidance to use `AddLambdaBootstrapHttpClient` or `TryAddLambdaBootstrapHttpClient` instead. --- src/AwsLambda.Host/Core/Options/LambdaHostOptions.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/AwsLambda.Host/Core/Options/LambdaHostOptions.cs b/src/AwsLambda.Host/Core/Options/LambdaHostOptions.cs index c6229f5b..d24b2fe3 100644 --- a/src/AwsLambda.Host/Core/Options/LambdaHostOptions.cs +++ b/src/AwsLambda.Host/Core/Options/LambdaHostOptions.cs @@ -11,6 +11,12 @@ public class LambdaHostOptions /// runtime API. Provide a custom client to control connection pooling, timeout settings, or other /// HTTP-level behaviors. /// + [Obsolete( + "This property will be removed in version 2.0.0. Use " + + "AddLambdaBootstrapHttpClient() or TryAddLambdaBootstrapHttpClient() extension methods " + + "instead.", + false + )] public HttpClient? BootstrapHttpClient { get; set; } = null; /// Gets or sets the options for configuring the Lambda bootstrap behavior. From fd2691b9adb07655915bd093b4d64d5b4886a91a Mon Sep 17 00:00:00 2001 From: Jonas Ha Date: Sat, 6 Dec 2025 08:57:09 -0500 Subject: [PATCH 06/10] feat(aws-lambda): enhance Lambda-specific HttpClient configuration methods - Added XML documentation for `AddLambdaBootstrapHttpClient` and `TryAddLambdaBootstrapHttpClient` methods. - Introduced new overloads for `AddLambdaBootstrapHttpClient` and `TryAddLambdaBootstrapHttpClient`. - Supported configurations for registering HttpClient instances or factories with dependency injection. - Improved support for mocking, testing, and user-defined HttpClient configurations. --- ...daHttpClientServiceCollectionExtensions.cs | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs b/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs index 82fb05a0..20c65192 100644 --- a/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs +++ b/src/AwsLambda.Host/Builder/Extensions/LambdaHttpClientServiceCollectionExtensions.cs @@ -3,10 +3,23 @@ namespace AwsLambda.Host.Builder.Extensions; +/// +/// Extension methods for configuring the Lambda bootstrap HTTP client in an +/// . +/// public static class LambdaHttpClientServiceCollectionExtensions { extension(IServiceCollection services) { + /// Adds a custom HTTP client instance for the Lambda bootstrap runtime API. + /// The type of to register. + /// The pre-configured instance. + /// The for chaining. + /// + /// Registers a keyed singleton that will be used by the Lambda + /// bootstrap to communicate with the Lambda runtime API. This overload is useful for testing + /// scenarios where you want to inject a mock or fake HTTP client. + /// public IServiceCollection AddLambdaBootstrapHttpClient(T client) where T : HttpClient { @@ -17,6 +30,22 @@ public IServiceCollection AddLambdaBootstrapHttpClient(T client) return services; } + /// + /// Adds a factory for creating a custom HTTP client for the Lambda bootstrap runtime API. + /// + /// + /// A factory function that creates the instance. The function + /// receives the and service key. + /// + /// The for chaining. + /// + /// + /// Registers a keyed singleton factory that will be used by the + /// Lambda bootstrap to communicate with the Lambda runtime API. This overload provides + /// access to the dependency injection container, allowing you to resolve other services + /// when constructing the HTTP client. + /// + /// public IServiceCollection AddLambdaBootstrapHttpClient( Func factory ) @@ -28,6 +57,18 @@ public IServiceCollection AddLambdaBootstrapHttpClient( return services; } + /// + /// Attempts to add a custom HTTP client instance for the Lambda bootstrap runtime API if one is + /// not already registered. + /// + /// The type of to register. + /// The pre-configured instance. + /// + /// Registers a keyed singleton that will be used by the Lambda + /// bootstrap to communicate with the Lambda runtime API, but only if a keyed HTTP client has + /// not already been registered. This overload is useful for testing scenarios where you want + /// to inject a mock or fake HTTP client without overwriting user-supplied configurations. + /// public void TryAddLambdaBootstrapHttpClient(T client) where T : HttpClient { @@ -36,6 +77,21 @@ public void TryAddLambdaBootstrapHttpClient(T client) services.TryAddKeyedSingleton(typeof(ILambdaBootstrapOrchestrator), client); } + /// + /// Attempts to add a factory for creating a custom HTTP client for the Lambda bootstrap runtime + /// API if one is not already registered. + /// + /// + /// A factory function that creates the instance. The function + /// receives the and service key. + /// + /// + /// + /// Registers a keyed singleton factory that will be used by the + /// Lambda bootstrap to communicate with the Lambda runtime API, but only if a keyed HTTP + /// client has not already been registered. + /// + /// public void TryAddLambdaBootstrapHttpClient( Func factory ) From d2e67a34647617393bc6e7f576088face8cd8a86 Mon Sep 17 00:00:00 2001 From: Jonas Ha Date: Sat, 6 Dec 2025 08:59:32 -0500 Subject: [PATCH 07/10] test(aws-lambda): add unit tests for LambdaHttpClientServiceCollectionExtensions - Added comprehensive test coverage for `AddLambdaBootstrapHttpClient` methods. - Verified exception handling for null arguments and proper service registration. - Added tests for `TryAddLambdaBootstrapHttpClient` to ensure duplicate registrations are prevented. - Confirmed method chaining behavior for fluent configurations. --- ...pClientServiceCollectionExtensionsTests.cs | 237 ++++++++++++++++++ 1 file changed, 237 insertions(+) create mode 100644 tests/AwsLambda.Host.UnitTests/Builder/Extensions/LambdaHttpClientServiceCollectionExtensionsTests.cs diff --git a/tests/AwsLambda.Host.UnitTests/Builder/Extensions/LambdaHttpClientServiceCollectionExtensionsTests.cs b/tests/AwsLambda.Host.UnitTests/Builder/Extensions/LambdaHttpClientServiceCollectionExtensionsTests.cs new file mode 100644 index 00000000..7eb29534 --- /dev/null +++ b/tests/AwsLambda.Host.UnitTests/Builder/Extensions/LambdaHttpClientServiceCollectionExtensionsTests.cs @@ -0,0 +1,237 @@ +using AwsLambda.Host.Builder.Extensions; +using Microsoft.Extensions.DependencyInjection; + +namespace AwsLambda.Host.UnitTests.Builder.Extensions; + +[TestSubject(typeof(LambdaHttpClientServiceCollectionExtensions))] +public class LambdaHttpClientServiceCollectionExtensionsTests +{ + [Fact] + public void AddLambdaBootstrapHttpClient_WithNullServiceCollection_ThrowsArgumentNullException() + { + // Act + var act = () => ((IServiceCollection)null!).AddLambdaBootstrapHttpClient(new HttpClient()); + + // Assert + act.Should().ThrowExactly(); + } + + [Fact] + public void AddLambdaBootstrapHttpClient_WithNullClient_ThrowsArgumentNullException() + { + // Arrange + var serviceCollection = new ServiceCollection(); + + // Act + var act = () => serviceCollection.AddLambdaBootstrapHttpClient((HttpClient)null!); + + // Assert + act.Should().ThrowExactly(); + } + + [Fact] + public void AddLambdaBootstrapHttpClient_WithValidClient_ReturnsServiceCollection() + { + // Arrange + var serviceCollection = new ServiceCollection(); + var httpClient = new HttpClient(); + + // Act + var result = serviceCollection.AddLambdaBootstrapHttpClient(httpClient); + + // Assert + result.Should().BeSameAs(serviceCollection); + } + + [Fact] + public void AddLambdaBootstrapHttpClient_WithValidClient_RegistersKeyedSingleton() + { + // Arrange + var serviceCollection = new ServiceCollection(); + var httpClient = new HttpClient(); + + // Act + serviceCollection.AddLambdaBootstrapHttpClient(httpClient); + var provider = serviceCollection.BuildServiceProvider(); + + // Assert + var registeredClient = provider.GetKeyedService( + typeof(ILambdaBootstrapOrchestrator) + ); + registeredClient.Should().BeSameAs(httpClient); + } + + [Fact] + public void AddLambdaBootstrapHttpClient_WithNullFactory_ThrowsArgumentNullException() + { + // Arrange + var serviceCollection = new ServiceCollection(); + + // Act + var act = () => serviceCollection.AddLambdaBootstrapHttpClient(null!); + + // Assert + act.Should().ThrowExactly(); + } + + [Fact] + public void AddLambdaBootstrapHttpClient_WithValidFactory_ReturnsServiceCollection() + { + // Arrange + var serviceCollection = new ServiceCollection(); + + // Act + var result = serviceCollection.AddLambdaBootstrapHttpClient((sp, key) => new HttpClient()); + + // Assert + result.Should().BeSameAs(serviceCollection); + } + + [Fact] + public void AddLambdaBootstrapHttpClient_WithValidFactory_RegistersKeyedSingleton() + { + // Arrange + var serviceCollection = new ServiceCollection(); + var httpClient = new HttpClient(); + + // Act + serviceCollection.AddLambdaBootstrapHttpClient((sp, key) => httpClient); + var provider = serviceCollection.BuildServiceProvider(); + + // Assert + var registeredClient = provider.GetKeyedService( + typeof(ILambdaBootstrapOrchestrator) + ); + registeredClient.Should().BeSameAs(httpClient); + } + + [Fact] + public void TryAddLambdaBootstrapHttpClient_WithNullServiceCollection_ThrowsArgumentNullException() + { + // Act + var act = () => + ((IServiceCollection)null!).TryAddLambdaBootstrapHttpClient(new HttpClient()); + + // Assert + act.Should().ThrowExactly(); + } + + [Fact] + public void TryAddLambdaBootstrapHttpClient_WithNullClient_ThrowsArgumentNullException() + { + // Arrange + var serviceCollection = new ServiceCollection(); + + // Act + var act = () => serviceCollection.TryAddLambdaBootstrapHttpClient((HttpClient)null!); + + // Assert + act.Should().ThrowExactly(); + } + + [Fact] + public void TryAddLambdaBootstrapHttpClient_WithValidClient_RegistersKeyedSingleton() + { + // Arrange + var serviceCollection = new ServiceCollection(); + var httpClient = new HttpClient(); + + // Act + serviceCollection.TryAddLambdaBootstrapHttpClient(httpClient); + var provider = serviceCollection.BuildServiceProvider(); + + // Assert + var registeredClient = provider.GetKeyedService( + typeof(ILambdaBootstrapOrchestrator) + ); + registeredClient.Should().BeSameAs(httpClient); + } + + [Fact] + public void TryAddLambdaBootstrapHttpClient_WhenAlreadyRegistered_DoesNotOverwrite() + { + // Arrange + var serviceCollection = new ServiceCollection(); + var firstClient = new HttpClient(); + var secondClient = new HttpClient(); + + // Act + serviceCollection.TryAddLambdaBootstrapHttpClient(firstClient); + serviceCollection.TryAddLambdaBootstrapHttpClient(secondClient); + var provider = serviceCollection.BuildServiceProvider(); + + // Assert + var registeredClient = provider.GetKeyedService( + typeof(ILambdaBootstrapOrchestrator) + ); + registeredClient.Should().BeSameAs(firstClient); + } + + [Fact] + public void TryAddLambdaBootstrapHttpClient_WithNullFactory_ThrowsArgumentNullException() + { + // Arrange + var serviceCollection = new ServiceCollection(); + + // Act + var act = () => serviceCollection.TryAddLambdaBootstrapHttpClient(null!); + + // Assert + act.Should().ThrowExactly(); + } + + [Fact] + public void TryAddLambdaBootstrapHttpClient_WithValidFactory_RegistersKeyedSingleton() + { + // Arrange + var serviceCollection = new ServiceCollection(); + var httpClient = new HttpClient(); + + // Act + serviceCollection.TryAddLambdaBootstrapHttpClient((sp, key) => httpClient); + var provider = serviceCollection.BuildServiceProvider(); + + // Assert + var registeredClient = provider.GetKeyedService( + typeof(ILambdaBootstrapOrchestrator) + ); + registeredClient.Should().BeSameAs(httpClient); + } + + [Fact] + public void TryAddLambdaBootstrapHttpClient_WithFactory_WhenAlreadyRegistered_DoesNotOverwrite() + { + // Arrange + var serviceCollection = new ServiceCollection(); + var firstClient = new HttpClient(); + var secondClient = new HttpClient(); + + // Act + serviceCollection.TryAddLambdaBootstrapHttpClient((sp, key) => firstClient); + serviceCollection.TryAddLambdaBootstrapHttpClient((sp, key) => secondClient); + var provider = serviceCollection.BuildServiceProvider(); + + // Assert + var registeredClient = provider.GetKeyedService( + typeof(ILambdaBootstrapOrchestrator) + ); + registeredClient.Should().BeSameAs(firstClient); + } + + [Fact] + public void AddLambdaBootstrapHttpClient_EnablesMethodChaining() + { + // Arrange + var serviceCollection = new ServiceCollection(); + var firstClient = new HttpClient(); + var secondClient = new HttpClient(); + + // Act + var result = serviceCollection + .AddLambdaBootstrapHttpClient(firstClient) + .AddLambdaBootstrapHttpClient((sp, key) => secondClient); + + // Assert + result.Should().BeSameAs(serviceCollection); + } +} From 33d8fddbc566667c0fb802fad1c5bdf91b8507d7 Mon Sep 17 00:00:00 2001 From: Jonas Ha Date: Sat, 6 Dec 2025 09:07:49 -0500 Subject: [PATCH 08/10] feat(aws-lambda): implement dependency injection for HttpClient in LambdaBootstrapAdapter - Updated `LambdaBootstrapAdapter` to support injecting a `HttpClient` via DI for better testability. - Deprecated direct usage of `BootstrapHttpClient` property in favor of DI-based resolution. - Added safeguards to handle cases where the keyed service is not present, maintaining backward compatibility. --- .../Runtime/LambdaBootstrapAdapter.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/AwsLambda.Host/Runtime/LambdaBootstrapAdapter.cs b/src/AwsLambda.Host/Runtime/LambdaBootstrapAdapter.cs index c6f20536..1986ef05 100644 --- a/src/AwsLambda.Host/Runtime/LambdaBootstrapAdapter.cs +++ b/src/AwsLambda.Host/Runtime/LambdaBootstrapAdapter.cs @@ -1,5 +1,6 @@ using Amazon.Lambda.Core; using Amazon.Lambda.RuntimeSupport; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; namespace AwsLambda.Host.Runtime; @@ -10,12 +11,23 @@ namespace AwsLambda.Host.Runtime; /// internal sealed class LambdaBootstrapAdapter : ILambdaBootstrapOrchestrator { + private readonly HttpClient? _httpClient; private readonly LambdaHostOptions _settings; - public LambdaBootstrapAdapter(IOptions lambdaHostSettings) + public LambdaBootstrapAdapter( + IOptions lambdaHostSettings, + [FromKeyedServices(typeof(ILambdaBootstrapOrchestrator))] HttpClient? httpClient + ) { ArgumentNullException.ThrowIfNull(lambdaHostSettings); + // TODO: Remove this check once ILambdaBootstrapOrchestrator.BootstrapHttpClient is removed. + // until ILambdaBootstrapOrchestrator.BootstrapHttpClient is removed, we need to check for + // it if the keyed service is NOT present. +#pragma warning disable CS0618 // Type or member is obsolete + _httpClient = httpClient ?? lambdaHostSettings.Value.BootstrapHttpClient; +#pragma warning restore CS0618 // Type or member is obsolete + _settings = lambdaHostSettings.Value; } @@ -32,10 +44,10 @@ CancellationToken stoppingToken using var wrappedHandler = HandlerWrapper.GetHandlerWrapper(handler); // Create the bootstrap based on configuration. - using var bootstrap = _settings.BootstrapHttpClient is null + using var bootstrap = _httpClient is null ? new LambdaBootstrap(wrappedHandler, _settings.BootstrapOptions, convertedInitializer) : new LambdaBootstrap( - _settings.BootstrapHttpClient, + _httpClient, wrappedHandler, _settings.BootstrapOptions, convertedInitializer From d6f56d86b9febe4e2bb90ed7dee9299ddb8689f6 Mon Sep 17 00:00:00 2001 From: Jonas Ha Date: Sat, 6 Dec 2025 09:14:54 -0500 Subject: [PATCH 09/10] refactor(aws-lambda): update XML doc for deprecated BootstrapHttpClient property - Clarified that keyed service registrations override the BootstrapHttpClient property. - Included references to AddLambdaBootstrapHttpClient and TryAddLambdaBootstrapHttpClient. --- src/AwsLambda.Host/Core/Options/LambdaHostOptions.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/AwsLambda.Host/Core/Options/LambdaHostOptions.cs b/src/AwsLambda.Host/Core/Options/LambdaHostOptions.cs index d24b2fe3..953c05cc 100644 --- a/src/AwsLambda.Host/Core/Options/LambdaHostOptions.cs +++ b/src/AwsLambda.Host/Core/Options/LambdaHostOptions.cs @@ -1,4 +1,5 @@ using Amazon.Lambda.RuntimeSupport.Bootstrap; +using AwsLambda.Host.Builder.Extensions; namespace AwsLambda.Host.Options; @@ -8,8 +9,10 @@ public class LambdaHostOptions /// Gets or sets an optional custom HTTP client for the Lambda bootstrap. /// /// When null, the bootstrap will create its own HTTP client for communicating with the Lambda - /// runtime API. Provide a custom client to control connection pooling, timeout settings, or other - /// HTTP-level behaviors. + /// runtime API. This property will be overridden by keyed service registrations from + /// or + /// + /// extension methods. /// [Obsolete( "This property will be removed in version 2.0.0. Use " From 89dc300b9fcd7b6ededfb674557cab09c0759dd4 Mon Sep 17 00:00:00 2001 From: Jonas Ha Date: Sat, 6 Dec 2025 09:15:13 -0500 Subject: [PATCH 10/10] refactor(aws-lambda): set default value for HttpClient in LambdaBootstrapAdapter constructor - Updated HttpClient parameter in `LambdaBootstrapAdapter` constructor to use a default null value. - Improves flexibility when HttpClient is omitted or not explicitly provided. --- src/AwsLambda.Host/Runtime/LambdaBootstrapAdapter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AwsLambda.Host/Runtime/LambdaBootstrapAdapter.cs b/src/AwsLambda.Host/Runtime/LambdaBootstrapAdapter.cs index 1986ef05..6dc13276 100644 --- a/src/AwsLambda.Host/Runtime/LambdaBootstrapAdapter.cs +++ b/src/AwsLambda.Host/Runtime/LambdaBootstrapAdapter.cs @@ -16,7 +16,7 @@ internal sealed class LambdaBootstrapAdapter : ILambdaBootstrapOrchestrator public LambdaBootstrapAdapter( IOptions lambdaHostSettings, - [FromKeyedServices(typeof(ILambdaBootstrapOrchestrator))] HttpClient? httpClient + [FromKeyedServices(typeof(ILambdaBootstrapOrchestrator))] HttpClient? httpClient = null ) { ArgumentNullException.ThrowIfNull(lambdaHostSettings);