diff --git a/Package.swift b/Package.swift index 4d21044..c268ce9 100644 --- a/Package.swift +++ b/Package.swift @@ -16,7 +16,7 @@ let package = Package( .package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", from: "1.0.0-alpha.1"), .package(url: "https://github.com/swift-server/swift-aws-lambda-events.git", from: "0.3.0"), .package(url: "https://github.com/swift-extras/swift-extras-base64.git", from: "1.0.0"), - .package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0-beta.7"), + .package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0-rc.1"), .package(url: "https://github.com/apple/swift-nio.git", from: "2.32.0"), ], targets: [ diff --git a/Sources/HummingbirdLambda/LambdaHandler.swift b/Sources/HummingbirdLambda/LambdaHandler.swift index 942c441..1386cdc 100644 --- a/Sources/HummingbirdLambda/LambdaHandler.swift +++ b/Sources/HummingbirdLambda/LambdaHandler.swift @@ -51,16 +51,7 @@ struct LambdaFunctionHandler: LambdaHandler { source: .init(event: event, lambdaContext: context) ) let request = try lambda.request(context: context, from: event) - let response: Response - do { - response = try await self.responder.respond(to: request, context: requestContext) - } catch { - if let error = error as? HTTPResponseError { - response = error.response(allocator: context.allocator) - } else { - throw error - } - } + let response = try await self.responder.respond(to: request, context: requestContext) return try await self.lambda.output(from: response) } diff --git a/Tests/HummingbirdLambdaTests/LambdaTests.swift b/Tests/HummingbirdLambdaTests/LambdaTests.swift index bd82a1d..24d2f8d 100644 --- a/Tests/HummingbirdLambdaTests/LambdaTests.swift +++ b/Tests/HummingbirdLambdaTests/LambdaTests.swift @@ -149,7 +149,7 @@ final class LambdaTests: XCTestCase { } try await HelloLambda.test { client in try await client.execute(uri: "/", method: .post) { response in - let expectedBody = "{\"error\":{\"message\":\"\(HelloLambda.body)\"}}\n" + let expectedBody = "{\"error\":{\"message\":\"\(HelloLambda.body)\"}}" XCTAssertEqual(response.statusCode, .badRequest) XCTAssertEqual(response.body, expectedBody) XCTAssertEqual(response.headers?["Content-Length"], expectedBody.utf8.count.description)