Skip to content

Commit 8696f55

Browse files
committed
fix ci
1 parent b3844f7 commit 8696f55

File tree

7 files changed

+50
-43
lines changed

7 files changed

+50
-43
lines changed

.licenseignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ Package.resolved
3333
*.yml
3434
*.json
3535
*.gif
36+
Makefile

Examples/quoteapi-alb/Sources/QuoteAPI/QuoteService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
//
33
// This source file is part of the Swift OpenAPI Lambda open source project
44
//
5-
// Copyright (c) 2023 Amazon.com, Inc. or its affiliates
6-
// and the Swift OpenAPI Lambda project authors
5+
// Copyright Swift OpenAPI Lambda project authors
6+
// Copyright (c) Amazon.com, Inc. or its affiliates.
77
// Licensed under Apache License v2.0
88
//
99
// See LICENSE.txt for license information

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
format:
2-
@swift format -i -r Package.swift Examples Sources
2+
@swift format -i -r Package.swift Examples Sources Tests

Sources/EventSource/ALB/ALBTargetGroup+HTTPRequest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extension ALBTargetGroupRequest {
2323
let headers = self.headers ?? [:]
2424
let scheme = headers.first { $0.key.lowercased() == "x-forwarded-proto" }?.value
2525
let authority = headers.first { $0.key.lowercased() == "host" }?.value
26-
26+
2727
return HTTPRequest(
2828
method: self.httpMethod,
2929
scheme: scheme,

Tests/OpenAPILambdaTests/ALBConversionTests.swift

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Testing
2020
@testable import OpenAPILambda
2121

2222
struct ALBConversionTests {
23-
23+
2424
static let albEventJSON = """
2525
{
2626
"requestContext": {
@@ -40,21 +40,27 @@ struct ALBConversionTests {
4040
"isBase64Encoded": false
4141
}
4242
"""
43-
43+
4444
@Test("ALB request to HTTPRequest conversion")
4545
func testALBRequestToHTTPRequest() throws {
4646
let data = ALBConversionTests.albEventJSON.data(using: .utf8)!
4747
let albRequest = try JSONDecoder().decode(ALBTargetGroupRequest.self, from: data)
48-
48+
4949
let httpRequest = try albRequest.httpRequest()
50-
50+
5151
#expect(httpRequest.method == HTTPRequest.Method.get)
5252
#expect(httpRequest.path == "/stocks/AAPL")
53-
#expect(httpRequest.headerFields[HTTPField.Name.accept] == "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
53+
#expect(
54+
httpRequest.headerFields[HTTPField.Name.accept]
55+
== "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
56+
)
5457
#expect(httpRequest.headerFields[HTTPField.Name("host")!] == "lambda-alb-123578498.us-east-1.elb.amazonaws.com")
55-
#expect(httpRequest.headerFields[HTTPField.Name.userAgent] == "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36")
58+
#expect(
59+
httpRequest.headerFields[HTTPField.Name.userAgent]
60+
== "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
61+
)
5662
}
57-
63+
5864
@Test("ALB X-Forwarded-Proto and Host mapping")
5965
func testALBForwardedHeaders() throws {
6066
let albEventWithForwardedHeaders = """
@@ -75,16 +81,16 @@ struct ALBConversionTests {
7581
"isBase64Encoded": false
7682
}
7783
"""
78-
84+
7985
let data = albEventWithForwardedHeaders.data(using: .utf8)!
8086
let albRequest = try JSONDecoder().decode(ALBTargetGroupRequest.self, from: data)
81-
87+
8288
let httpRequest = try albRequest.httpRequest()
83-
89+
8490
#expect(httpRequest.scheme == "https")
8591
#expect(httpRequest.authority == "lambda-alb-123578498.us-east-1.elb.amazonaws.com")
8692
}
87-
93+
8894
@Test("ALB lowercase headers mapping")
8995
func testALBLowercaseHeaders() throws {
9096
let albEventWithLowercaseHeaders = """
@@ -105,29 +111,29 @@ struct ALBConversionTests {
105111
"isBase64Encoded": false
106112
}
107113
"""
108-
114+
109115
let data = albEventWithLowercaseHeaders.data(using: .utf8)!
110116
let albRequest = try JSONDecoder().decode(ALBTargetGroupRequest.self, from: data)
111-
117+
112118
let httpRequest = try albRequest.httpRequest()
113-
119+
114120
#expect(httpRequest.scheme == "https")
115121
#expect(httpRequest.authority == "lambda-alb-123578498.us-east-1.elb.amazonaws.com")
116122
}
117-
123+
118124
@Test("HTTPResponse to ALB response conversion")
119125
func testHTTPResponseToALBResponse() throws {
120126
var httpResponse = HTTPResponse(status: .ok)
121127
httpResponse.headerFields[HTTPField.Name.contentType] = "application/json"
122128
httpResponse.headerFields[HTTPField.Name.contentLength] = "42"
123-
129+
124130
let albResponse = ALBTargetGroupResponse(from: httpResponse)
125-
131+
126132
#expect(albResponse.statusCode == .ok)
127133
#expect(albResponse.headers?[HTTPField.Name.contentType.rawName] == "application/json")
128134
#expect(albResponse.headers?[HTTPField.Name.contentLength.rawName] == "42")
129135
#expect(albResponse.isBase64Encoded == false)
130136
}
131-
132137

133-
}
138+
139+
}

Tests/OpenAPILambdaTests/APIGatewayV2ConversionTests.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Testing
2020
@testable import OpenAPILambda
2121

2222
struct APIGatewayV2ConversionTests {
23-
23+
2424
static let apiGatewayEventJSON = """
2525
{
2626
"rawQueryString": "",
@@ -53,7 +53,7 @@ struct APIGatewayV2ConversionTests {
5353
"rawPath": "/stocks/AAPL"
5454
}
5555
"""
56-
56+
5757
static let apiGatewayEventWithQueryJSON = """
5858
{
5959
"rawQueryString": "limit=10&offset=0",
@@ -83,14 +83,14 @@ struct APIGatewayV2ConversionTests {
8383
"rawPath": "/stocks/AAPL"
8484
}
8585
"""
86-
86+
8787
@Test("API Gateway v2 request to HTTPRequest conversion")
8888
func testAPIGatewayV2RequestToHTTPRequest() throws {
8989
let data = APIGatewayV2ConversionTests.apiGatewayEventJSON.data(using: .utf8)!
9090
let apiGatewayRequest = try JSONDecoder().decode(APIGatewayV2Request.self, from: data)
91-
91+
9292
let httpRequest = try apiGatewayRequest.httpRequest()
93-
93+
9494
#expect(httpRequest.method == HTTPRequest.Method.get)
9595
#expect(httpRequest.path == "/stocks/AAPL")
9696
#expect(httpRequest.scheme == "https")
@@ -99,29 +99,29 @@ struct APIGatewayV2ConversionTests {
9999
#expect(httpRequest.headerFields[HTTPField.Name.userAgent] == "curl/8.1.2")
100100
#expect(httpRequest.headerFields[HTTPField.Name.authorization] == "Bearer 123")
101101
}
102-
102+
103103
@Test("API Gateway v2 request with query string")
104104
func testAPIGatewayV2RequestWithQueryString() throws {
105105
let data = APIGatewayV2ConversionTests.apiGatewayEventWithQueryJSON.data(using: .utf8)!
106106
let apiGatewayRequest = try JSONDecoder().decode(APIGatewayV2Request.self, from: data)
107-
107+
108108
let httpRequest = try apiGatewayRequest.httpRequest()
109-
109+
110110
#expect(httpRequest.path == "/stocks/AAPL?limit=10&offset=0")
111111
}
112-
112+
113113
@Test("HTTPResponse to API Gateway v2 response conversion")
114114
func testHTTPResponseToAPIGatewayV2Response() throws {
115115
var httpResponse = HTTPResponse(status: .ok)
116116
httpResponse.headerFields[HTTPField.Name.contentType] = "application/json"
117117
httpResponse.headerFields[HTTPField.Name.contentLength] = "42"
118-
118+
119119
let apiGatewayResponse = APIGatewayV2Response(from: httpResponse)
120-
120+
121121
#expect(apiGatewayResponse.statusCode == .ok)
122122
#expect(apiGatewayResponse.headers?[HTTPField.Name.contentType.rawName] == "application/json")
123123
#expect(apiGatewayResponse.headers?[HTTPField.Name.contentLength.rawName] == "42")
124124
#expect(apiGatewayResponse.isBase64Encoded == false)
125125
#expect(apiGatewayResponse.cookies == nil)
126126
}
127-
}
127+
}

Tests/OpenAPILambdaTests/HTTPHeadersConversionTests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,29 @@ import Testing
2020

2121
@Suite("HTTP Headers Conversion Tests")
2222
struct HTTPHeadersConversionTests {
23-
23+
2424
@Test("Multi-value headers preserved as comma-separated")
2525
func testMultiValueHeadersPreserved() throws {
2626
var httpResponse = HTTPResponse(status: .ok)
2727
httpResponse.headerFields.append(HTTPField(name: HTTPField.Name.setCookie, value: "session=abc123"))
2828
httpResponse.headerFields.append(HTTPField(name: HTTPField.Name.setCookie, value: "theme=dark"))
29-
29+
3030
let albResponse = ALBTargetGroupResponse(from: httpResponse)
31-
31+
3232
#expect(albResponse.headers?[HTTPField.Name.setCookie.rawName] == "session=abc123, theme=dark")
3333
#expect(albResponse.multiValueHeaders == nil)
3434
}
35-
35+
3636
@Test("HTTPHeaders to HTTPFields conversion")
3737
func testHTTPHeadersToHTTPFields() throws {
3838
let headers: HTTPHeaders = [
3939
"Set-Cookie": "session=abc123, theme=dark",
40-
"Content-Type": "application/json"
40+
"Content-Type": "application/json",
4141
]
42-
42+
4343
let httpFields = headers.httpFields()
44-
44+
4545
#expect(httpFields[HTTPField.Name.setCookie] == "session=abc123, theme=dark")
4646
#expect(httpFields[HTTPField.Name.contentType] == "application/json")
4747
}
48-
}
48+
}

0 commit comments

Comments
 (0)