Skip to content

Commit 5601a10

Browse files
committed
Avoid using production HTTP request executor unless needed in tests
1 parent d179502 commit 5601a10

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Sources/SwiftlyCore/SwiftlyCore.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ public struct SwiftlyCoreContext: Sendable {
4545
self.currentDirectory = cwd
4646
}
4747

48+
public init(httpClient: SwiftlyHTTPClient) {
49+
self.httpClient = httpClient
50+
self.currentDirectory = cwd
51+
}
52+
4853
/// Pass the provided string to the set output handler if any.
4954
/// If no output handler has been set, just print to stdout.
5055
public func print(_ string: String = "", terminator: String? = nil) async {

Tests/SwiftlyTests/SwiftlyTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ extension SwiftlyCoreContext {
6565
outputHandler: (any OutputHandler)?,
6666
inputProvider: (any InputProvider)?
6767
) {
68-
self.init()
68+
self.init(httpClient: SwiftlyHTTPClient(httpRequestExecutor: httpRequestExecutor))
6969

7070
self.mockedHomeDir = mockedHomeDir
7171
self.currentDirectory = mockedHomeDir ?? cwd

0 commit comments

Comments
 (0)