Skip to content

Commit 6982829

Browse files
authored
chore(auth): update AppSyncSigner (#4063)
* chore: update AppSyncSigner * chore: fix tests
1 parent 6e45ff1 commit 6982829

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/AWSCognitoAuthPlugin+AppSyncSigner.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ extension AWSCognitoAuthPlugin {
3131
return { request in
3232
try await signAppSyncRequest(
3333
request,
34-
35-
region: region
34+
region: region
3635
)
3736
}
3837
}
@@ -113,8 +112,6 @@ extension AWSCognitoAuthPlugin {
113112
}
114113

115114
var headers = urlRequest.allHTTPHeaderFields ?? [:]
116-
headers.updateValue(host, forKey: "host")
117-
118115
let httpMethod = (urlRequest.httpMethod?.uppercased())
119116
.flatMap(HTTPMethodType.init(rawValue:)) ?? .get
120117

AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/AWSCognitoAuthPluginAppSyncSignerTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class AWSCognitoAuthPluginAppSyncSignerTests: XCTestCase {
3030
XCTAssertEqual(request.method, .post)
3131
XCTAssertEqual(request.endpoint.port, 443)
3232
XCTAssertEqual(request.endpoint.protocolType, .https)
33-
XCTAssertEqual(request.endpoint.headers.headers, [.init(name: "host", value: "graphql.com")])
3433
guard case let .data(data) = request.body else {
3534
XCTFail("Unexpected body")
3635
return

AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/AppSyncSignerTests/AppSyncSignerTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class AppSyncSignerTests: AWSAuthBaseTest {
2727
XCTFail("Missing headers")
2828
return
2929
}
30-
XCTAssertEqual(headers.count, 4)
30+
XCTAssertEqual(headers.count, 3)
3131
let containsExpectedHeaders = headers.keys.contains(where: { key in
32-
key == "Authorization" || key == "Host" || key == "X-Amz-Security-Token" || key == "X-Amz-Date"
32+
key == "Authorization" || key == "X-Amz-Security-Token" || key == "X-Amz-Date"
3333
})
3434
XCTAssertTrue(containsExpectedHeaders)
3535
}

0 commit comments

Comments
 (0)