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 {
84
84
)
85
85
}
86
86
}
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
+ }
88
106
@available ( LambdaSwift 2 . 0 , * )
89
107
extension LambdaRuntime {
90
108
/// 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 {
86
86
try await self . write ( buffer, hasCustomHeaders: false )
87
87
}
88
88
}
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
59
59
}
60
60
61
61
#if !ServiceLifecycleSupport
62
- @inlinable
63
- internal func run( ) async throws {
62
+ public func run( ) async throws {
64
63
try await _run ( )
65
64
}
66
65
#endif
67
66
68
67
/// Make sure only one run() is called at a time
69
- // @inlinable
70
68
internal func _run( ) async throws {
71
69
72
70
// 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