mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-21 14:11:16 +00:00
89b4bfd245
- Register IHttpClientFactory named client "GoogleMapsTiles" inside AddTileDownloader() with User-Agent and 100s timeout (preserves HttpClient's implicit default). - Resolve the same named client from all three CreateClient() call sites in GoogleMapsDownloaderV2 (session token, single-tile, batch-tile retry lambda) and drop the duplicated per-call UserAgent.ParseAdd setup. - Expose USER_AGENT, the client name, and the timeout as internal consts on GoogleMapsDownloaderV2 so the extension and the downloader share one source of truth. - Add AC test that builds the DI container, resolves the named client, and asserts both the User-Agent header and the timeout. - Archive AZ-374 task file: todo/ -> done/. 175 unit + 5 smoke pass. Co-authored-by: Cursor <cursoragent@cursor.com>
21 lines
812 B
C#
21 lines
812 B
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using SatelliteProvider.Common.Interfaces;
|
|
|
|
namespace SatelliteProvider.Services.TileDownloader;
|
|
|
|
public static class TileDownloaderServiceCollectionExtensions
|
|
{
|
|
public static IServiceCollection AddTileDownloader(this IServiceCollection services)
|
|
{
|
|
services.AddMemoryCache();
|
|
services.AddHttpClient(GoogleMapsDownloaderV2.GoogleMapsTilesClientName, c =>
|
|
{
|
|
c.DefaultRequestHeaders.UserAgent.ParseAdd(GoogleMapsDownloaderV2.UserAgent);
|
|
c.Timeout = TimeSpan.FromSeconds(GoogleMapsDownloaderV2.DefaultHttpClientTimeoutSeconds);
|
|
});
|
|
services.AddSingleton<ISatelliteDownloader, GoogleMapsDownloaderV2>();
|
|
services.AddSingleton<ITileService, TileService>();
|
|
return services;
|
|
}
|
|
}
|