Skip to content

Commit 2c6c328

Browse files
committed
make sure the lib compiles when no traits are enabled
1 parent 303559d commit 2c6c328

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

Sources/AWSLambdaRuntime/FoundationSupport/Lambda+JSON.swift

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff 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, *)
89107
extension LambdaRuntime {
90108
/// Initialize an instance with a `LambdaHandler` defined in the form of a closure **with a non-`Void` return type**.

Sources/AWSLambdaRuntime/LambdaResponseStreamWriter+Headers.swift

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff 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-
}

Sources/AWSLambdaRuntime/LambdaRuntime.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)