Skip to content

Commit b83ca05

Browse files
committed
test: add comprehensive test suite for authentication module
- Add extensive tests for Bearer and Basic authentication clients - Test authentication header injection and persistence - Add API routing and request building tests - Include error handling and validation tests - Add real-world integration test scenarios - Fix file header comments in client implementation
1 parent 91ee2f2 commit b83ca05

File tree

3 files changed

+642
-20
lines changed

3 files changed

+642
-20
lines changed

Sources/Authenticating/Authenticating Client.swift

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,18 @@ extension Authenticating {
110110
public subscript<T>(dynamicMember keyPath: KeyPath<ClientOutput, T>) -> T {
111111
@Sendable
112112
func makeRequest(for api: API) throws -> URLRequest {
113-
do {
114-
let data = try authenticatedRouter.print(.init(auth: auth, api: api))
115-
116-
guard let request = URLRequest(data: data) else {
117-
throw Error.requestError
118-
}
119-
120-
return request
121-
} catch {
122-
throw Error.printError
113+
let data = try authenticatedRouter.print(.init(auth: auth, api: api))
114+
115+
guard let request = URLRequest(data: data) else {
116+
throw Error.requestError
123117
}
118+
119+
return request
124120
}
125121

126122
return withEscapedDependencies { dependencies in
127-
buildClient { api in
128-
try dependencies.yield {
123+
buildClient { api in
124+
try dependencies.yield {
129125
try makeRequest(for: api)
130126
}
131127
}[keyPath: keyPath]

0 commit comments

Comments
 (0)