File tree Expand file tree Collapse file tree 3 files changed +20
-24
lines changed Expand file tree Collapse file tree 3 files changed +20
-24
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,25 @@ extension LambdaCodableAdapter {
8484 )
8585 }
8686}
87-
87+ @available ( LambdaSwift 2 . 0 , * )
88+ extension LambdaResponseStreamWriter {
89+ /// Writes the HTTP status code and headers to the response stream.
90+ ///
91+ /// This method serializes the status and headers as JSON and writes them to the stream,
92+ /// followed by eight null bytes as a separator before the response body.
93+ ///
94+ /// - Parameters:
95+ /// - response: The status and headers response to write
96+ /// - encoder: The encoder to use for serializing the response, use JSONEncoder by default
97+ /// - Throws: An error if JSON serialization or writing fails
98+ public func writeStatusAndHeaders(
99+ _ response: StreamingLambdaStatusAndHeadersResponse ,
100+ encoder: JSONEncoder = JSONEncoder ( )
101+ ) async throws {
102+ encoder. outputFormatting = . withoutEscapingSlashes
103+ try await self . writeStatusAndHeaders ( response, encoder: LambdaJSONOutputEncoder ( encoder) )
104+ }
105+ }
88106@available ( LambdaSwift 2 . 0 , * )
89107extension LambdaRuntime {
90108 /// Initialize an instance with a `LambdaHandler` defined in the form of a closure **with a non-`Void` return type**.
Original file line number Diff line number Diff line change @@ -86,23 +86,3 @@ extension LambdaResponseStreamWriter {
8686 try await self . write ( buffer, hasCustomHeaders: false )
8787 }
8888}
89-
90- @available ( LambdaSwift 2 . 0 , * )
91- extension LambdaResponseStreamWriter {
92- /// Writes the HTTP status code and headers to the response stream.
93- ///
94- /// This method serializes the status and headers as JSON and writes them to the stream,
95- /// followed by eight null bytes as a separator before the response body.
96- ///
97- /// - Parameters:
98- /// - response: The status and headers response to write
99- /// - encoder: The encoder to use for serializing the response, use JSONEncoder by default
100- /// - Throws: An error if JSON serialization or writing fails
101- public func writeStatusAndHeaders(
102- _ response: StreamingLambdaStatusAndHeadersResponse ,
103- encoder: JSONEncoder = JSONEncoder ( )
104- ) async throws {
105- encoder. outputFormatting = . withoutEscapingSlashes
106- try await self . writeStatusAndHeaders ( response, encoder: LambdaJSONOutputEncoder ( encoder) )
107- }
108- }
Original file line number Diff line number Diff line change @@ -59,14 +59,12 @@ public final class LambdaRuntime<Handler>: Sendable where Handler: StreamingLamb
5959 }
6060
6161 #if !ServiceLifecycleSupport
62- @inlinable
63- internal func run( ) async throws {
62+ public func run( ) async throws {
6463 try await _run ( )
6564 }
6665 #endif
6766
6867 /// Make sure only one run() is called at a time
69- // @inlinable
7068 internal func _run( ) async throws {
7169
7270 // we use an atomic global variable to ensure only one LambdaRuntime is running at the time
You can’t perform that action at this time.
0 commit comments