Skip to content

Commit 007dc69

Browse files
committed
fix format
1 parent f3db5e1 commit 007dc69

File tree

3 files changed

+49
-44
lines changed

3 files changed

+49
-44
lines changed

Sources/AWSLambdaEvents/APIGateway+V2.swift

+6-5
Original file line numberDiff line numberDiff line change
@@ -151,20 +151,21 @@ public struct APIGatewayV2Response: Codable, Sendable {
151151
extension APIGatewayV2Request: Decodable {
152152
public init(from decoder: Decoder) throws {
153153
let container = try decoder.container(keyedBy: CodingKeys.self)
154-
154+
155155
self.version = try container.decode(String.self, forKey: .version)
156156
self.routeKey = try container.decode(String.self, forKey: .routeKey)
157157
self.rawPath = try container.decode(String.self, forKey: .rawPath)
158158
self.rawQueryString = try container.decode(String.self, forKey: .rawQueryString)
159-
159+
160160
self.cookies = try container.decodeIfPresent([String].self, forKey: .cookies) ?? []
161161
self.headers = try container.decodeIfPresent(HTTPHeaders.self, forKey: .headers) ?? HTTPHeaders()
162-
self.queryStringParameters = try container.decodeIfPresent([String: String].self, forKey: .queryStringParameters) ?? [:]
162+
self.queryStringParameters =
163+
try container.decodeIfPresent([String: String].self, forKey: .queryStringParameters) ?? [:]
163164
self.pathParameters = try container.decodeIfPresent([String: String].self, forKey: .pathParameters) ?? [:]
164-
165+
165166
self.context = try container.decode(Context.self, forKey: .context)
166167
self.stageVariables = try container.decodeIfPresent([String: String].self, forKey: .stageVariables) ?? [:]
167-
168+
168169
self.body = try container.decodeIfPresent(String.self, forKey: .body)
169170
self.isBase64Encoded = try container.decode(Bool.self, forKey: .isBase64Encoded)
170171
}

Sources/AWSLambdaEvents/APIGateway.swift

+7-3
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,14 @@ extension APIGatewayRequest: Decodable {
108108
self.path = try container.decode(String.self, forKey: .path)
109109
self.httpMethod = try container.decode(HTTPRequest.Method.self, forKey: .httpMethod)
110110

111-
self.queryStringParameters = try container.decodeIfPresent([String: String].self, forKey: .queryStringParameters) ?? [:]
112-
self.multiValueQueryStringParameters = try container.decodeIfPresent([String: [String]].self, forKey: .multiValueQueryStringParameters) ?? [:]
111+
self.queryStringParameters =
112+
try container.decodeIfPresent([String: String].self, forKey: .queryStringParameters) ?? [:]
113+
self.multiValueQueryStringParameters =
114+
try container.decodeIfPresent([String: [String]].self, forKey: .multiValueQueryStringParameters) ?? [:]
113115
self.headers = try container.decodeIfPresent(HTTPHeaders.self, forKey: .headers) ?? HTTPHeaders()
114-
self.multiValueHeaders = try container.decodeIfPresent(HTTPMultiValueHeaders.self, forKey: .multiValueHeaders) ?? HTTPMultiValueHeaders()
116+
self.multiValueHeaders =
117+
try container.decodeIfPresent(HTTPMultiValueHeaders.self, forKey: .multiValueHeaders)
118+
?? HTTPMultiValueHeaders()
115119
self.pathParameters = try container.decodeIfPresent([String: String].self, forKey: .pathParameters) ?? [:]
116120
self.stageVariables = try container.decodeIfPresent([String: String].self, forKey: .stageVariables) ?? [:]
117121

Tests/AWSLambdaEventsTests/APIGateway+V2Tests.swift

+36-36
Original file line numberDiff line numberDiff line change
@@ -74,44 +74,44 @@ class APIGatewayV2Tests: XCTestCase {
7474
"""
7575

7676
static let exampleGetEventBodyNilHeaders = """
77-
{
78-
"routeKey":"GET /hello",
79-
"version":"2.0",
80-
"rawPath":"/hello",
81-
"requestContext":{
82-
"timeEpoch":1587750461466,
83-
"domainPrefix":"hello",
84-
"authorizer":{
85-
"jwt":{
86-
"scopes":[
87-
"hello"
88-
],
89-
"claims":{
90-
"aud":"customers",
91-
"iss":"https://hello.test.com/",
92-
"iat":"1587749276",
93-
"exp":"1587756476"
77+
{
78+
"routeKey":"GET /hello",
79+
"version":"2.0",
80+
"rawPath":"/hello",
81+
"requestContext":{
82+
"timeEpoch":1587750461466,
83+
"domainPrefix":"hello",
84+
"authorizer":{
85+
"jwt":{
86+
"scopes":[
87+
"hello"
88+
],
89+
"claims":{
90+
"aud":"customers",
91+
"iss":"https://hello.test.com/",
92+
"iat":"1587749276",
93+
"exp":"1587756476"
94+
}
9495
}
95-
}
96-
},
97-
"accountId":"0123456789",
98-
"stage":"$default",
99-
"domainName":"hello.test.com",
100-
"apiId":"pb5dg6g3rg",
101-
"requestId":"LgLpnibOFiAEPCA=",
102-
"http":{
103-
"path":"/hello",
104-
"userAgent":"Paw/3.1.10 (Macintosh; OS X/10.15.4) GCDHTTPRequest",
105-
"method":"GET",
106-
"protocol":"HTTP/1.1",
107-
"sourceIp":"91.64.117.86"
96+
},
97+
"accountId":"0123456789",
98+
"stage":"$default",
99+
"domainName":"hello.test.com",
100+
"apiId":"pb5dg6g3rg",
101+
"requestId":"LgLpnibOFiAEPCA=",
102+
"http":{
103+
"path":"/hello",
104+
"userAgent":"Paw/3.1.10 (Macintosh; OS X/10.15.4) GCDHTTPRequest",
105+
"method":"GET",
106+
"protocol":"HTTP/1.1",
107+
"sourceIp":"91.64.117.86"
108+
},
109+
"time":"24/Apr/2020:17:47:41 +0000"
108110
},
109-
"time":"24/Apr/2020:17:47:41 +0000"
110-
},
111-
"isBase64Encoded":false,
112-
"rawQueryString":"foo=bar"
113-
}
114-
"""
111+
"isBase64Encoded":false,
112+
"rawQueryString":"foo=bar"
113+
}
114+
"""
115115

116116
static let fullExamplePayload = """
117117
{

0 commit comments

Comments
 (0)