Skip to content

Commit a1caf89

Browse files
committed
Update swift lambda event dependency to version 0.3.0
1 parent f596b22 commit a1caf89

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let package = Package(
1212
dependencies: [
1313
.package(url: "https://github.com/apple/swift-openapi-runtime.git", from: "1.0.0"),
1414
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", from: "1.0.0-alpha.1"),
15-
.package(url: "https://github.com/swift-server/swift-aws-lambda-events.git", from: "0.1.0"),
15+
.package(url: "https://github.com/swift-server/swift-aws-lambda-events.git", from: "0.3.0"),
1616
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"),
1717
],
1818
targets: [

Sources/HttpApi/APIGatewayV2+HTTPRequest.swift

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,10 @@ import OpenAPIRuntime
1818

1919
extension APIGatewayV2Request {
2020

21-
/// Return an `HTTPRequest.Method` for this `APIGatewayV2Request`
22-
public func httpRequestMethod() throws -> HTTPRequest.Method {
23-
guard let method = HTTPRequest.Method(rawValue: self.context.http.method.rawValue) else {
24-
throw OpenAPILambdaHttpError.invalidMethod(self.context.http.method.rawValue)
25-
}
26-
return method
27-
}
28-
2921
/// Return an `HTTPRequest` for this `APIGatewayV2Request`
3022
public func httpRequest() throws -> HTTPRequest {
31-
try HTTPRequest(
32-
method: self.httpRequestMethod(),
23+
HTTPRequest(
24+
method: self.context.http.method,
3325
scheme: "https",
3426
authority: "",
3527
path: self.rawPath,
@@ -43,7 +35,7 @@ extension APIGatewayV2Response {
4335
/// Create a `APIGatewayV2Response` from an `HTTPResponse`
4436
public init(from response: HTTPResponse) {
4537
self = APIGatewayV2Response(
46-
statusCode: .init(code: UInt(response.status.code)),
38+
statusCode: response.status,
4739
headers: .init(from: response.headerFields),
4840
isBase64Encoded: false,
4941
cookies: nil

0 commit comments

Comments
 (0)