@@ -154,7 +154,7 @@ public struct ClosureHandler<Event: Decodable, Output>: LambdaHandler {
154154
155155 /// Initialize with a closure handler over generic `Input` and `Output` types.
156156 /// - Parameter body: The handler function written as a closure.
157- public init ( body: @escaping ( Event , LambdaContext ) async throws -> Output ) where Output: Encodable {
157+ public init ( body: sending @escaping ( Event , LambdaContext ) async throws -> Output ) where Output: Encodable {
158158 self . body = body
159159 }
160160
@@ -192,8 +192,8 @@ extension LambdaRuntime {
192192 Encoder: LambdaOutputEncoder ,
193193 Decoder: LambdaEventDecoder
194194 > (
195- encoder: Encoder ,
196- decoder: Decoder ,
195+ encoder: sending Encoder,
196+ decoder: sending Decoder,
197197 body: sending @escaping ( Event , LambdaContext ) async throws -> Output
198198 )
199199 where
@@ -205,21 +205,23 @@ extension LambdaRuntime {
205205 Encoder
206206 >
207207 {
208- let handler = LambdaCodableAdapter (
208+ let closureHandler = ClosureHandler ( body: body)
209+ let streamingAdapter = LambdaHandlerAdapter ( handler: closureHandler)
210+ let codableWrapper = LambdaCodableAdapter (
209211 encoder: encoder,
210212 decoder: decoder,
211- handler: LambdaHandlerAdapter ( handler : ClosureHandler ( body : body ) )
213+ handler: streamingAdapter
212214 )
213215
214- self . init ( handler: handler )
216+ self . init ( handler: codableWrapper )
215217 }
216218
217219 /// Initialize an instance with a ``LambdaHandler`` defined in the form of a closure **with a `Void` return type**, an encoder, and a decoder.
218220 /// - Parameters:
219221 /// - decoder: The decoder object that will be used to decode the incoming `ByteBuffer` event into the generic `Event` type.
220222 /// - body: The handler in the form of a closure.
221223 public convenience init < Event: Decodable , Decoder: LambdaEventDecoder > (
222- decoder: Decoder ,
224+ decoder: sending Decoder,
223225 body: sending @escaping ( Event , LambdaContext ) async throws -> Void
224226 )
225227 where
0 commit comments