Skip to content

Commit feb352b

Browse files
committed
change name of arguments to avoid overriding other init() methods
1 parent 7424005 commit feb352b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Sources/AWSLambdaEvents/APIGateway+Encodable.swift

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

3434
public init<Input: Encodable>(
35-
body: Input,
3635
statusCode: HTTPResponse.Status,
3736
headers: HTTPHeaders? = nil,
38-
multiValueHeaders: HTTPMultiValueHeaders? = nil
37+
multiValueHeaders: HTTPMultiValueHeaders? = nil,
38+
encodableBody: Input
3939
) throws {
4040
self.init(
4141
statusCode: statusCode,
4242
headers: headers,
4343
multiValueHeaders: multiValueHeaders,
44-
body: try body.string(),
44+
body: try encodableBody.string(),
4545
isBase64Encoded: nil
4646
)
4747
}
@@ -50,15 +50,15 @@ extension APIGatewayResponse {
5050
extension APIGatewayV2Response {
5151

5252
public init<Input: Encodable>(
53-
body: Input,
5453
statusCode: HTTPResponse.Status,
5554
headers: HTTPHeaders? = nil,
55+
encodableBody: Input,
5656
cookies: [String]? = nil
5757
) throws {
5858
self.init(
5959
statusCode: statusCode,
6060
headers: headers,
61-
body: try body.string(),
61+
body: try encodableBody.string(),
6262
isBase64Encoded: nil,
6363
cookies: cookies
6464
)

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(body: businessResponse, statusCode: .ok)
36+
try response = APIGatewayV2Response(statusCode: .ok, encodableBody: businessResponse)
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(body: businessResponse, statusCode: .ok)
60+
try response = APIGatewayResponse(statusCode: .ok, encodableBody: businessResponse)
6161
}
6262
try #require(response?.body != nil)
6363

0 commit comments

Comments
 (0)