Skip to content

Commit 5781034

Browse files
committed
apply swift format
1 parent 6bbd287 commit 5781034

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

Sources/AWSLambdaEvents/APIGateway+V2+Encodable.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
import HTTPTypes
16+
1517
#if canImport(FoundationEssentials)
1618
import class FoundationEssentials.JSONEncoder
1719
import class FoundationEssentials.Data
@@ -20,15 +22,13 @@ import class Foundation.JSONEncoder
2022
import struct Foundation.Data
2123
#endif
2224

23-
import HTTPTypes
24-
2525
public enum APIGatewayResponseError: Error {
2626
case failedToEncodeBody(Error)
2727
}
2828

2929
extension APIGatewayV2Response {
3030

31-
public init<Input: Encodable> (
31+
public init<Input: Encodable>(
3232
statusCode: HTTPResponse.Status,
3333
headers: HTTPHeaders? = nil,
3434
body: Input,

Tests/AWSLambdaEventsTests/APIGateway+V2+EncodableTests.swift

+10-12
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,38 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
import Foundation
1516
import Testing
1617

17-
import Foundation
18-
1918
@testable import AWSLambdaEvents
2019

2120
struct APIGatewayV2EncodableResponseTests {
2221

23-
2422
// MARK: Encoding
2523
struct BusinessResponse: Codable, Equatable {
2624
let message: String
2725
let code: Int
2826
}
2927

30-
@Test
28+
@Test
3129
func testResponseEncoding() throws {
3230

33-
// given
31+
// given
3432
let businessResponse = BusinessResponse(message: "Hello World", code: 200)
35-
33+
3634
var response: APIGatewayV2Response? = nil
37-
#expect(throws: Never.self) {
35+
#expect(throws: Never.self) {
3836
try response = APIGatewayV2Response(statusCode: .ok, body: businessResponse)
39-
}
37+
}
4038
try #require(response?.body != nil)
4139

42-
// when
43-
let body = response?.body?.data(using: .utf8)
40+
// when
41+
let body = response?.body?.data(using: .utf8)
4442
try #require(body != nil)
4543

46-
#expect(throws: Never.self) {
44+
#expect(throws: Never.self) {
4745
let encodedBody = try JSONDecoder().decode(BusinessResponse.self, from: body!)
48-
46+
4947
// then
5048
#expect(encodedBody == businessResponse)
5149
}

0 commit comments

Comments
 (0)