diff --git a/Sources/Gravatar/Network/Services/ImageDownloadService.swift b/Sources/Gravatar/Network/Services/ImageDownloadService.swift index 33b4f080..88a4f7c0 100644 --- a/Sources/Gravatar/Network/Services/ImageDownloadService.swift +++ b/Sources/Gravatar/Network/Services/ImageDownloadService.swift @@ -17,12 +17,12 @@ public struct ImageDownloadService: ImageDownloader, Sendable { /// - cache: A type which will perform image caching operations. public init(client: HTTPClient? = nil, cache: ImageCaching? = nil) { self.client = client ?? URLSessionHTTPClient() - self.imageCache = cache ?? ImageCache() + self.imageCache = cache ?? ImageCache.shared } public init(urlSession: URLSession, cache: ImageCaching? = nil) { self.client = URLSessionHTTPClient(urlSession: urlSession) - self.imageCache = cache ?? ImageCache() + self.imageCache = cache ?? ImageCache.shared } public func fetchImage(with url: URL, forceRefresh: Bool = false, processingMethod: ImageProcessingMethod = .common()) async throws -> ImageDownloadResult { diff --git a/Tests/GravatarTests/AvatarServiceTests.swift b/Tests/GravatarTests/AvatarServiceTests.swift index 5fd49f74..97995445 100644 --- a/Tests/GravatarTests/AvatarServiceTests.swift +++ b/Tests/GravatarTests/AvatarServiceTests.swift @@ -11,7 +11,7 @@ final class AvatarServiceTests: XCTestCase { func testFetchImage() async throws { let response = HTTPURLResponse.successResponse(with: TestData.urlFromEmail) let sessionMock = URLSessionMock(returnData: ImageHelper.testImageData, response: response) - let service = avatarService(with: sessionMock) + let service = avatarService(with: sessionMock, cache: TestImageCache()) let options = ImageDownloadOptions() let imageResponse = try await service.fetch(with: .email(TestData.email), options: options) diff --git a/Tests/GravatarTests/ImageDownloadServiceTests.swift b/Tests/GravatarTests/ImageDownloadServiceTests.swift index 06c5dbb7..baae5fe9 100644 --- a/Tests/GravatarTests/ImageDownloadServiceTests.swift +++ b/Tests/GravatarTests/ImageDownloadServiceTests.swift @@ -7,7 +7,7 @@ final class ImageDownloadServiceTests: XCTestCase { let imageURL = "https://gravatar.com/avatar/HASH" let response = HTTPURLResponse.successResponse(with: URL(string: imageURL)!) let sessionMock = URLSessionMock(returnData: ImageHelper.testImageData, response: response) - let service = imageDownloadService(with: sessionMock) + let service = imageDownloadService(with: sessionMock, cache: TestImageCache()) let imageResponse = try await service.fetchImage(with: URL(string: imageURL)!) let request = await sessionMock.request diff --git a/version.rb b/version.rb index 4de1e428..49dc2173 100644 --- a/version.rb +++ b/version.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Gravatar - VERSION = '2.1.0' + VERSION = '2.1.1' SWIFT_VERSIONS = [ '5.10' ].freeze