Skip to content

Commit 7424005

Browse files
committed
change the order of the args to avoid breaking the existing API
1 parent 6a3aa0f commit 7424005

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Sources/AWSLambdaEvents/APIGateway+Encodable.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ extension Encodable {
3232
extension APIGatewayResponse {
3333

3434
public init<Input: Encodable>(
35+
body: Input,
3536
statusCode: HTTPResponse.Status,
3637
headers: HTTPHeaders? = nil,
37-
multiValueHeaders: HTTPMultiValueHeaders? = nil,
38-
body: Input
38+
multiValueHeaders: HTTPMultiValueHeaders? = nil
3939
) throws {
4040
self.init(
4141
statusCode: statusCode,
@@ -50,9 +50,9 @@ extension APIGatewayResponse {
5050
extension APIGatewayV2Response {
5151

5252
public init<Input: Encodable>(
53+
body: Input,
5354
statusCode: HTTPResponse.Status,
5455
headers: HTTPHeaders? = nil,
55-
body: Input,
5656
cookies: [String]? = nil
5757
) throws {
5858
self.init(

Tests/AWSLambdaEventsTests/APIGateway+EncodableTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct APIGatewayEncodableResponseTests {
3333

3434
var response: APIGatewayV2Response? = nil
3535
#expect(throws: Never.self) {
36-
try response = APIGatewayV2Response(statusCode: .ok, body: businessResponse)
36+
try response = APIGatewayV2Response(body: businessResponse, statusCode: .ok)
3737
}
3838
try #require(response?.body != nil)
3939

@@ -57,7 +57,7 @@ struct APIGatewayEncodableResponseTests {
5757

5858
var response: APIGatewayResponse? = nil
5959
#expect(throws: Never.self) {
60-
try response = APIGatewayResponse(statusCode: .ok, body: businessResponse)
60+
try response = APIGatewayResponse(body: businessResponse, statusCode: .ok)
6161
}
6262
try #require(response?.body != nil)
6363

Tests/AWSLambdaEventsTests/APIGatewayTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ class APIGatewayTests: XCTestCase {
9595
let isBase64Encoded: Bool?
9696
}
9797

98-
func testResponseEncoding() throws {
99-
let resp = try APIGatewayResponse(
98+
func testResponseEncoding() {
99+
let resp = APIGatewayResponse(
100100
statusCode: .ok,
101101
headers: ["Server": "Test"],
102102
body: "abc123"

0 commit comments

Comments
 (0)