Skip to content

Commit 585a414

Browse files
author
Sebastien Stormacq
committed
fix test on Linux
1 parent df989af commit 585a414

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Tests/AWSLambdaRuntimeTests/LambdaLocalServerTests.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ import FoundationEssentials
2525
import Foundation
2626
#endif
2727

28+
#if canImport(FoundationNetworking)
29+
import FoundationNetworking
30+
#else
31+
import Foundation
32+
#endif
33+
2834
extension LambdaRuntimeTests {
2935

3036
@Test("Local server respects LOCAL_LAMBDA_PORT environment variable")
@@ -159,7 +165,11 @@ extension LambdaRuntimeTests {
159165
let (data, response) = try await URLSession.shared.data(for: request)
160166

161167
guard let httpResponse = response as? HTTPURLResponse else {
162-
throw URLError(.badServerResponse)
168+
// Create a custom error since URLError might not be available on Linux
169+
struct HTTPError: Error {
170+
let message: String
171+
}
172+
throw HTTPError(message: "Bad server response")
163173
}
164174

165175
return (data, httpResponse)

0 commit comments

Comments
 (0)