public PlaybackHandler( IPlaybackContext playbackContext, IPlaybackStorageService playbackStorageService, string handlerName, IHttpClientPlaybackErrorSimulationService configService) : this(new HttpClientHandler(), playbackContext, playbackStorageService, handlerName, configService) { }
public MyPlaybackProxy(IPlaybackContext playbackContext, IPlaybackStorageService playbackStorageService, IHttpClientPlaybackErrorSimulationService configService) : base(new System.Net.Http.HttpClient()) { _playbackContext = playbackContext; _playbackStorageService = playbackStorageService; _configService = configService; base.HttpClient = HttpClientFactory.WithPlaybackContext(playbackContext, playbackStorageService, PROXY_NAME, configService); }
public static HttpClient WithPlaybackContext( IPlaybackContext playbackContext, IPlaybackStorageService playbackStorageService, string prefix, IHttpClientPlaybackErrorSimulationService configService) { var handler = new PlaybackHandler(playbackContext, playbackStorageService, prefix, configService); var httpClient = new HttpClient(handler); return(httpClient); }
public PlaybackHandler(HttpMessageHandler innerHandler, IPlaybackContext playbackContext, IPlaybackStorageService playbackStorageService, string handlerName, IHttpClientPlaybackErrorSimulationService configService) : base(innerHandler) { _playbackStorageService = playbackStorageService; _playbackContext = playbackContext; _handlerName = handlerName; _config = configService.GetNamedConfig(handlerName).Result; }
public PlaybackContext(IHttpContextAccessor accessor, IPlaybackStorageService playbackStorageService) { if (accessor == null) { throw new Exception("null Http Context accessor when creating Playback Context"); } if (accessor.HttpContext != null) { ReadHttpContext(accessor.HttpContext); } _playbackStorageService = playbackStorageService; }
public static void AddPlayback(this IServiceCollection services, IConfiguration configuration, IPlaybackStorageService playbackStorageService = null) { services.AddScoped <IHttpContextAccessor, HttpContextAccessor>(); services.AddScoped <IPlaybackContext, PlaybackContext>(); if (playbackStorageService == null) { if (configuration.GetSection("PlaybackStorage")?.GetValue <string>("ConnectionString")?.ToLower() == "local") { string name = configuration.GetSection("PlaybackStorage").GetValue <string>("ContainerName"); playbackStorageService = new PlaybackFileStorageService($"{AssemblyLoadDirectory}\\{name}\\"); } else { playbackStorageService = new PlaybackBlobStorageService(configuration); } } services.AddScoped <IPlaybackStorageService>(provider => playbackStorageService); }
public PlaybackMiddleware(RequestDelegate next, IPlaybackStorageService messageStorageService, IPlaybackContext playbackContext) { _messageStorageService = messageStorageService; _next = next; _playbackContext = playbackContext as PlaybackContext; }