@@ -37,7 +37,7 @@ extension HTTPClient: DependencyKey {
3737 . init(
3838 get: { url, headers in
3939 let req = try Request ( url: url, method: . GET, headers: headers)
40- return try await Vapor . HTTPClient . shared. execute ( request: req) . get ( )
40+ return try await shared. execute ( request: req) . get ( )
4141 } ,
4242 post: { url, headers, body in
4343 let req = try Request ( url: url, method: . POST, headers: headers, body: body. map ( { . data( $0) } ) )
@@ -71,6 +71,8 @@ extension HTTPClient: DependencyKey {
7171 func post( url: String , body: Data ? ) async throws -> Response {
7272 try await post ( url: url, headers: . init( ) , body: body)
7373 }
74+
75+ private static var shared : Vapor . HTTPClient { globallySharedHTTPClient }
7476}
7577
7678
@@ -87,6 +89,21 @@ extension DependencyValues {
8789}
8890
8991
92+ private let globallySharedHTTPClient : Vapor . HTTPClient = {
93+ var conf = Vapor . HTTPClient. Configuration. singletonConfiguration
94+ // 2026-04-14 sas: Increasing limit from default `.enabled(limit: .ratio(25))`, which caused requests to fail in the past.
95+ // https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/4024#issuecomment-4237684071
96+ conf. decompression = . enabled( limit: . size( Constants . httpDecompressionSizeLimit) )
97+
98+ let httpClient = Vapor . HTTPClient (
99+ eventLoopGroup: Vapor . HTTPClient. defaultEventLoopGroup,
100+ configuration: conf,
101+ backgroundActivityLogger: . noop
102+ )
103+ return httpClient
104+ } ( )
105+
106+
90107#if DEBUG
91108// Convenience initialisers to make testing easier
92109
0 commit comments