public HttpRpcClient(ISerializer serializer, ILog log, HttpClientConfig clientConfig) { _clientConfig = clientConfig; _serializer = serializer; _log = log; _httpClient = new HttpClient(); }
private CosXmlConfig(Builder builder) { this.appid = builder.appid; this.region = builder.region; this.isHttps = builder.isHttps; this.httpConfig = builder.httpClientConfigBuilder.Build(); }
public void ConfigureServices(IServiceCollection services) { var marsRoverClientConfig = new HttpClientConfig(); Configuration.GetSection("MarsRover").Bind(marsRoverClientConfig); var marsRoverApiKeyConfig = new ApiKeyConfig(); Configuration.GetSection("Auth:MarsRover").Bind(marsRoverApiKeyConfig); services.AddSingleton <IApiKeyConfig>(marsRoverApiKeyConfig); services.AddHttpClient <IMarsRoverService, MarsRoverService>( client => { client.BaseAddress = marsRoverClientConfig.Url; client.DefaultRequestHeaders.Add("Accept", "application/json"); }); // TODO: Add retry services.AddHttpClient <IImageService, ImageService>(); services.AddScoped <IFileService, FileService>(); services.AddControllers(); }
public void Equals_Different_Value_Returns_False() { var options1 = new HttpClientConfig { SslProtocols = SslProtocols.Tls11, DangerousAcceptAnyServerCertificate = false, MaxConnectionsPerServer = 20, #if NET RequestHeaderEncoding = Encoding.UTF8.WebName #endif }; var options2 = new HttpClientConfig { SslProtocols = SslProtocols.Tls12, DangerousAcceptAnyServerCertificate = true, MaxConnectionsPerServer = 20, #if NET RequestHeaderEncoding = Encoding.Latin1.WebName #endif }; var equals = options1.Equals(options2); Assert.False(equals); }
public void Equals_Same_Value_Returns_True() { var options1 = new HttpClientConfig { SslProtocols = SslProtocols.Tls11, DangerousAcceptAnyServerCertificate = false, MaxConnectionsPerServer = 20, WebProxy = new WebProxyConfig() { Address = new Uri("http://localhost:8080"), BypassOnLocal = true, UseDefaultCredentials = true }, RequestHeaderEncoding = Encoding.UTF8.WebName, }; var options2 = new HttpClientConfig { SslProtocols = SslProtocols.Tls11, DangerousAcceptAnyServerCertificate = false, MaxConnectionsPerServer = 20, WebProxy = new WebProxyConfig() { Address = new Uri("http://localhost:8080"), BypassOnLocal = true, UseDefaultCredentials = true }, RequestHeaderEncoding = Encoding.UTF8.WebName, }; var equals = options1.Equals(options2); Assert.True(equals); Assert.True(options1 == options2); Assert.False(options1 != options2); Assert.Equal(options1.GetHashCode(), options2.GetHashCode()); }
private static HttpClient InitializeClient() { var client = new HttpClient(new DnsSensitiveClientHandler()); HttpClientConfig.ConfigureRequestHeadersAndSize(client); return(client); }
public SimpleHttpClientFactory() { _httpClient = new HttpClient(new HttpClientHandler() { UseDefaultCredentials = true }); HttpClientConfig.ConfigureRequestHeadersAndSize(_httpClient); }
private static void EnsureInitialized() { if (s_httpClient == null) { s_httpClient = new HttpClient(new DnsSensitiveClientHandler()); HttpClientConfig.ConfigureRequestHeadersAndSize(s_httpClient); } }
private CosXmlConfig(Builder builder) { this.appid = builder.appid; this.region = builder.region; this.isHttps = builder.isHttps; this.httpConfig = builder.httpClientConfigBuilder.Build(); this.isDebug = builder.isDebug; this.endpointSuffix = builder.endpointSuffix; this.host = builder.host; }
private static HttpClient InitializeClient() { var httpClient = new HttpClient(new HttpClientHandler() { UseDefaultCredentials = true }); HttpClientConfig.ConfigureRequestHeadersAndSize(httpClient); return(httpClient); }
public HttpClient GetHttpClient() { // For Mono, continue to create HttpClient for each PublicClientApplication // as static instance seems to have problems // https://forums.xamarin.com/discussion/144802/do-you-use-singleton-httpclient-or-dispose-create-new-instance-every-time var httpClient = new HttpClient( // As per Xamarin guidance https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/http-stack?tabs=windows new Xamarin.Android.Net.AndroidClientHandler()); HttpClientConfig.ConfigureRequestHeadersAndSize(httpClient); return(httpClient); }
public void Equals_Second_Null_Returns_False() { var options1 = new HttpClientConfig { SslProtocols = SslProtocols.Tls11, DangerousAcceptAnyServerCertificate = false, MaxConnectionsPerServer = 20 }; var equals = options1.Equals(null); Assert.False(equals); }
public ApiRequestExecutor(string host, DataType dataType, CompressionType compressionType, ILogger logger) : base(host, compressionType, logger) { _dataType = dataType; var config = new HttpClientConfig { Headers = new Dictionary <string, string>(), ContentTypeHeader = "application/" + _dataType, HostBasicName = Host }; ConfigureConnection(config); }
public void CreateClient_ApplyDangerousAcceptAnyServerCertificate_Success() { var factory = new ForwarderHttpClientFactory(Mock <ILogger <ForwarderHttpClientFactory> >().Object); var options = new HttpClientConfig { DangerousAcceptAnyServerCertificate = true }; var client = factory.CreateClient(new ForwarderHttpClientContext { NewConfig = options }); var handler = GetHandler(client); Assert.NotNull(handler); Assert.NotNull(handler.SslOptions.RemoteCertificateValidationCallback); Assert.True(handler.SslOptions.RemoteCertificateValidationCallback(default, default, default, default));
public HttpClient GetHttpClient() { HttpClient httpClient; if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0)) { httpClient = new HttpClient(new NSUrlSessionHandler()); } else { httpClient = new HttpClient(); } HttpClientConfig.ConfigureRequestHeadersAndSize(httpClient); return(httpClient); }
private static IServiceCollection ConfigureServices() { var Configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile($"{AppDomain.CurrentDomain.BaseDirectory}\\appsettings.json", optional: false, reloadOnChange: true) .Build(); var services = new ServiceCollection(); var logger = new LoggerConfiguration() .ReadFrom.Configuration(Configuration) .Enrich.FromLogContext() .CreateLogger(); services.AddLogging(config => { config.AddSerilog(logger: logger, dispose: true); }); var appConfig = new AppConfig(); Configuration.GetSection("Input").Bind(appConfig); services.AddSingleton <IAppConfig>(appConfig); var marsRoverApiKeyConfig = new ApiKeyConfig(); Configuration.GetSection("Auth:MarsRover").Bind(marsRoverApiKeyConfig); services.AddSingleton <IApiKeyConfig>(marsRoverApiKeyConfig); var marsRoverClientConfig = new HttpClientConfig(); Configuration.GetSection("MarsRover").Bind(marsRoverClientConfig); services.AddHttpClient <IMarsRoverService, MarsRoverService>( client => { client.BaseAddress = marsRoverClientConfig.Url; client.DefaultRequestHeaders.Add("Accept", "application/json"); }); services.AddHttpClient <IImageService, ImageService>(); services.AddScoped <IFileService, FileService>(); services.AddTransient <ImageDownloadApp>(); return(services); }
public void CreateClient_ApplySslProtocols_Success() { var factory = new ForwarderHttpClientFactory(Mock <ILogger <ForwarderHttpClientFactory> >().Object); var options = new HttpClientConfig { SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13, }; var client = factory.CreateClient(new ForwarderHttpClientContext { NewConfig = options }); var handler = GetHandler(client); Assert.NotNull(handler); Assert.Equal(SslProtocols.Tls12 | SslProtocols.Tls13, handler.SslOptions.EnabledSslProtocols); VerifyDefaultValues(handler, "SslProtocols"); }
private static HttpClient InitializeClient() { var handler = new SocketsHttpHandler { // https://github.com/dotnet/corefx/issues/26895 // https://github.com/dotnet/corefx/issues/26331 // https://github.com/dotnet/corefx/pull/26839 PooledConnectionLifetime = HttpClientConfig.ConnectionLifeTime, PooledConnectionIdleTimeout = HttpClientConfig.ConnectionLifeTime, MaxConnectionsPerServer = HttpClientConfig.MaxConnections, }; var client = new HttpClient(handler); HttpClientConfig.ConfigureRequestHeadersAndSize(client); return(client); }
static async Task Main(string[] args) { var config = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false) .Build(); HttpClientConfig clientConfig = new HttpClientConfig(); config.GetSection("HttpClientConfig").Bind(clientConfig); CertificateConfig certificateConfig = new CertificateConfig(); config.GetSection("CertificateConfig").Bind(certificateConfig); MaskinportenConfig maskinportenConfig = new MaskinportenConfig(); config.GetSection("MaskinportenConfig").Bind(maskinportenConfig); var host = new HostBuilder() .ConfigureServices((hostContext, services) => { services.Configure <RequestConfig>(config.GetSection("RequestConfig")); services.Configure <AccreditationConfig>(config.GetSection("Accreditation")); services.Configure <MaskinportenConfig>(config.GetSection("MaskinportenConfig")); services.Configure <CertificateConfig>(config.GetSection("CertificateConfig")); services.AddTransient <RequestService>(); services.AddTransient <AccreditationService>(); services.AddTransient <MaskinportenService>(); services.AddHttpClient("", c => { c.BaseAddress = new Uri(clientConfig.BaseAddress); c.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", clientConfig.SubscriptionKey); }); }).Build(); RequestService requestHandler = host.Services.GetRequiredService <RequestService>(); Console.WriteLine(await requestHandler.Demo()); await host.RunAsync(); }
public ApiHttpXmlRequestExecutor(string host, string userName, string password, CompressionType compressionType, ILogger logger) : base(host, userName, password, compressionType, logger) { var config = new HttpClientConfig { Headers = new Dictionary <string, string> { { "X-Fusion-Api-Key", "123456789!" }, { "Authorization", $"{"Basic"} {Convert.ToBase64String(Encoding.ASCII.GetBytes($"{UserName}:{Password}"))}" } }, ContentTypeHeader = "application/xml", HostBasicName = Host, }; ConfigureConnection(config); }
private static void EnsureInitialized() { if (s_httpClient == null) { var handler = new SocketsHttpHandler { // https://github.com/dotnet/corefx/issues/26895 // https://github.com/dotnet/corefx/issues/26331 // https://github.com/dotnet/corefx/pull/26839 PooledConnectionLifetime = HttpClientConfig.ConnectionLifeTime, PooledConnectionIdleTimeout = HttpClientConfig.ConnectionLifeTime, MaxConnectionsPerServer = HttpClientConfig.MaxConnections, }; s_httpClient = new HttpClient(handler); HttpClientConfig.ConfigureRequestHeadersAndSize(s_httpClient); ConfigureServicePointManager(); } }
public HttpClient GetHttpClient() { HttpClient httpClient; if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0)) { var handler = new NSUrlSessionHandler() { BypassBackgroundSessionCheck = false, }; httpClient = new HttpClient(handler); } else { httpClient = new HttpClient(); } HttpClientConfig.ConfigureRequestHeadersAndSize(httpClient); return(httpClient); }
public void Equals_Same_WebProxyAddress_Returns_True() { var options1 = new HttpClientConfig { WebProxy = new WebProxyConfig() { Address = new Uri("http://localhost:8080"), BypassOnLocal = true, UseDefaultCredentials = true } }; var options2 = new HttpClientConfig { WebProxy = new WebProxyConfig() { Address = new Uri("http://localhost:8080"), BypassOnLocal = true, UseDefaultCredentials = true } }; var equals = options1.Equals(options2); Assert.True(equals); Assert.True(options1 == options2); Assert.False(options1 != options2); }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { BeginContext(88, 2, true); WriteLiteral("\r\n"); EndContext(); #line 5 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CourseCategory.cshtml" HttpClientConfig httpClientConfig = new HttpClientConfig(); #line default #line hidden BeginContext(162, 2, true); WriteLiteral("\r\n"); EndContext(); #line 9 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CourseCategory.cshtml" Layout = "_LearnDashboardLayout"; #line default #line hidden BeginContext(218, 103, true); WriteLiteral("\r\n<div class=\"container\">\r\n <div class=\"d-flex\">\r\n <h1 class=\"c-h1\">Courses Categories</h1>\r\n"); EndContext(); BeginContext(462, 40, true); WriteLiteral(" </div>\r\n <div class=\"row mt-5\">\r\n"); EndContext(); #line 19 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CourseCategory.cshtml" if (ViewBag.CourseCategoryList != null) { #line default #line hidden #line 21 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CourseCategory.cshtml" foreach (var r in ViewBag.CourseCategoryList) { //Api call for course category by Id var apiResponse = await httpClientConfig.GetRestResponse("Course/coursesByCategoryId?categoryId=" + r.id + "", ""); var result = JsonConvert.DeserializeObject <CourseDataResponse>(apiResponse); long countCourses = 0; if (result.Data != null) { foreach (var rr in result.Data) { countCourses = countCourses + 1; } } if (@r.categoryImageUrl == null) { r.categoryImageUrl = "../dist2/img/categories/6.jpg"; } #line default #line hidden BeginContext(1367, 176, true); WriteLiteral(" <div class=\"col-lg-4 col-md-6\">\r\n <div class=\"card\">\r\n <figure>\r\n <img class=\"card-img-top\""); EndContext(); BeginWriteAttribute("src", " src=\"", 1543, "\"", 1568, 1); #line 45 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CourseCategory.cshtml" WriteAttributeValue("", 1549, r.categoryImageUrl, 1549, 19, false); #line default #line hidden EndWriteAttribute(); BeginContext(1569, 204, true); WriteLiteral(" alt=\"Image\">\r\n </figure>\r\n <div class=\"card-body card-body-courses\">\r\n <div class=\"ci-text\">\r\n <p> "); EndContext(); BeginContext(1773, 122, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "aa5db0017917408039b4f332f795fbab3ff346d57286", async() => { BeginContext(1861, 4, true); WriteLiteral("<h5>"); EndContext(); BeginContext(1866, 20, false); #line 49 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CourseCategory.cshtml" Write(r.courseCategoryName); #line default #line hidden EndContext(); BeginContext(1886, 5, true); WriteLiteral("</h5>"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-categoryId", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 49 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CourseCategory.cshtml" WriteLiteral(r.id); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["categoryId"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-categoryId", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["categoryId"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1895, 45, true); WriteLiteral("</p>\r\n <span>"); EndContext(); BeginContext(1941, 12, false); #line 50 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CourseCategory.cshtml" Write(countCourses); #line default #line hidden EndContext(); BeginContext(1953, 137, true); WriteLiteral(" Courses</span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n"); EndContext(); #line 55 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CourseCategory.cshtml" } #line default #line hidden #line 56 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CourseCategory.cshtml" } #line default #line hidden BeginContext(2118, 24, true); WriteLiteral("\r\n </div>\r\n</div>"); EndContext(); }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { BeginContext(88, 4, true); WriteLiteral("\r\n\r\n"); EndContext(); #line 6 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\NewView.cshtml" HttpClientConfig httpClientConfig = new HttpClientConfig(); #line default #line hidden BeginContext(164, 4, true); WriteLiteral("\r\n\r\n"); EndContext(); #line 11 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\NewView.cshtml" Layout = "_NewLearnerLayout"; #line default #line hidden BeginContext(210, 923, true); WriteLiteral(@" <section class=""categories-section spad""> <!-- <div class=""app-main""> --> <!-- <h2>Our Course Categories</h2> --> <!-- <div class=""row""> --> <div class=""container-fluid""> <div class=""row""> <div class=""col-lg-2 col-md-2 col-sm-3 col-xs-12 p-l-0""> <div class=""app-sidebar""> <div class=""scrollbar-sidebar""> <div class=""app-sidebar__inner""> <ul class=""vertical-nav-menu""> <li class=""app-sidebar__heading""></li> <li> <a href=""#"" class=""mm-active""> <!-- <i class=""material-icons md-16 menu-icon"">dashboard</i> --> Categories </a> </li> "); EndContext(); #line 33 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\NewView.cshtml" if (ViewBag.CourseCategoryList != null) { foreach (var r in ViewBag.CourseCategoryList) { #line default #line hidden BeginContext(1364, 92, true); WriteLiteral(" <li>\r\n <a"); EndContext(); BeginWriteAttribute("href", " href=\"", 1456, "\"", 1507, 2); WriteAttributeValue("", 1463, "/Learner/CoursesByCategory?categoryId=", 1463, 38, true); #line 38 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\NewView.cshtml" WriteAttributeValue(" ", 1501, r.id, 1502, 5, false); #line default #line hidden EndWriteAttribute(); BeginContext(1508, 156, true); WriteLiteral(">\r\n <!-- <i class=\"material-icons md-16 menu-icon\"></i> -->\r\n "); EndContext(); BeginContext(1665, 20, false); #line 40 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\NewView.cshtml" Write(r.courseCategoryName); #line default #line hidden EndContext(); BeginContext(1685, 99, true); WriteLiteral("\r\n </a>\r\n </li>\r\n"); EndContext(); #line 43 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\NewView.cshtml" } } #line default #line hidden BeginContext(1858, 2402, true); WriteLiteral(@" </ul> </div> </div> </div> </div> <!--<div class=""col-lg-10 col-md-10 col-sm-9 col-xs-12""> <div class=""app-main""> <h2 class=""mb-3"">Course<br>Categories</h2> <div class=""app-main__inner""> <div class=""row""> <!-- categorie --> <!--if (ViewBag.CourseCategoryList != null) { foreach (var r in ViewBag.CourseCategoryList) { //Api call for course category by Id var apiResponse = await httpClientConfig.GetRestResponse(""Course/coursesByCategoryId?categoryId="" + r.id + """", """"); var result = JsonConvert.DeserializeObject<CourseDataResponse>(apiResponse); "); WriteLiteral(@" long countCourses = 0; if (result.Data != null) { foreach (var rr in result.Data) { countCourses = countCourses + 1; } } <div class=""col-lg-4 col-md-6""> <div class=""categorie-item""> if (r.categoryImageUrl != null) { <div class=""ci-thumb set-bg"" data-setbg=""r.categoryImageUrl""></div> } else { <div class="); WriteLiteral(@"""ci-thumb set-bg"" data-setbg=""../assets/img/categories/1.jpg""></div> } <div class=""ci-text""> <a asp-route-categoryId=""r.id"" asp-controller=""home"" asp-action=""CoursesByCategory""><h5>r.courseCategoryName</h5></a>--> "); EndContext(); BeginContext(4662, 2, true); WriteLiteral("\r\n"); EndContext(); BeginContext(5748, 101, true); WriteLiteral(" </div>\r\n\r\n\r\n <!-- </div> -->\r\n <!-- <div class=\"container\"> -->\r\n\r\n\r\n</section>"); EndContext(); }
protected void ConfigureConnection(HttpClientConfig config) { ApiHttpClientConfig = config; }
public void Equals_Different_Value_Returns_False() { var config1 = new ClusterConfig { ClusterId = "cluster1", Destinations = new Dictionary <string, DestinationConfig>(StringComparer.OrdinalIgnoreCase) { { "destinationA", new DestinationConfig { Address = "https://localhost:10000/destA", Health = "https://localhost:20000/destA", Metadata = new Dictionary <string, string> { { "destA-K1", "destA-V1" }, { "destA-K2", "destA-V2" } } } }, { "destinationB", new DestinationConfig { Address = "https://localhost:10000/destB", Health = "https://localhost:20000/destB", Metadata = new Dictionary <string, string> { { "destB-K1", "destB-V1" }, { "destB-K2", "destB-V2" } } } } }, HealthCheck = new HealthCheckConfig { Passive = new PassiveHealthCheckConfig { Enabled = true, Policy = "FailureRate", ReactivationPeriod = TimeSpan.FromMinutes(5) }, Active = new ActiveHealthCheckConfig { Enabled = true, Interval = TimeSpan.FromSeconds(4), Timeout = TimeSpan.FromSeconds(6), Policy = "Any5xxResponse", Path = "healthCheckPath" } }, LoadBalancingPolicy = LoadBalancingPolicies.Random, SessionAffinity = new SessionAffinityConfig { Enabled = true, FailurePolicy = "Return503Error", Policy = "Cookie", AffinityKeyName = "Key1", Cookie = new SessionAffinityCookieConfig { Domain = "localhost", Expiration = TimeSpan.FromHours(3), HttpOnly = true, IsEssential = true, MaxAge = TimeSpan.FromDays(1), Path = "mypath", SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Strict, SecurePolicy = Microsoft.AspNetCore.Http.CookieSecurePolicy.SameAsRequest } }, HttpClient = new HttpClientConfig { SslProtocols = SslProtocols.Tls11 | SslProtocols.Tls12, MaxConnectionsPerServer = 10, DangerousAcceptAnyServerCertificate = true, ActivityContextHeaders = ActivityContextHeaders.CorrelationContext, }, HttpRequest = new ForwarderRequestConfig { Timeout = TimeSpan.FromSeconds(60), Version = Version.Parse("1.0"), #if NET VersionPolicy = HttpVersionPolicy.RequestVersionExact, #endif }, Metadata = new Dictionary <string, string> { { "cluster1-K1", "cluster1-V1" }, { "cluster1-K2", "cluster1-V2" } } }; Assert.False(config1.Equals(config1 with { ClusterId = "different" })); Assert.False(config1.Equals(config1 with { Destinations = new Dictionary <string, DestinationConfig>() })); Assert.False(config1.Equals(config1 with { HealthCheck = new HealthCheckConfig() })); Assert.False(config1.Equals(config1 with { LoadBalancingPolicy = "different" })); Assert.False(config1.Equals(config1 with { SessionAffinity = new SessionAffinityConfig { Enabled = true, FailurePolicy = "Return503Error", Policy = "Cookie", AffinityKeyName = "Key1", Cookie = new SessionAffinityCookieConfig { Domain = "localhost", Expiration = TimeSpan.FromHours(3), HttpOnly = true, IsEssential = true, MaxAge = TimeSpan.FromDays(1), Path = "newpath", SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Strict, SecurePolicy = Microsoft.AspNetCore.Http.CookieSecurePolicy.SameAsRequest } } })); Assert.False(config1.Equals(config1 with { HttpClient = new HttpClientConfig { SslProtocols = SslProtocols.Tls12, MaxConnectionsPerServer = 10, DangerousAcceptAnyServerCertificate = true, ActivityContextHeaders = ActivityContextHeaders.CorrelationContext, } })); Assert.False(config1.Equals(config1 with { HttpRequest = new ForwarderRequestConfig() { } })); Assert.False(config1.Equals(config1 with { Metadata = null })); }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { BeginContext(88, 2, true); WriteLiteral("\r\n"); EndContext(); #line 5 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CoursePreview.cshtml" HttpClientConfig httpClientConfig = new HttpClientConfig(); #line default #line hidden BeginContext(162, 2, true); WriteLiteral("\r\n"); EndContext(); #line 9 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CoursePreview.cshtml" Layout = "_CoursePreviewLayout"; #line default #line hidden BeginContext(209, 189, true); WriteLiteral("<section class=\"summary-section \">\r\n <div class=\"courseSummary\">\r\n <div class=\"container summary-content\">\r\n <div class=\"summary-text text-white\">\r\n <h2>"); EndContext(); BeginContext(399, 29, false); #line 16 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CoursePreview.cshtml" Write(ViewBag.CourseInfo.courseName); #line default #line hidden EndContext(); BeginContext(428, 546, true); WriteLiteral(@"</h2> <p> Are you ready to take your career to the next level? In this course, you will learn everything you need to know about business….from starting a company to taking it public. This course covers all of the important topics you will learn from getting an MBA from a top school + real life practical business concepts that will help make you more successful! </p> </div> <div class=""row""> <div class=""col-lg-6 text-left""> "); EndContext(); BeginContext(974, 474, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "1841d92595fecf85ccad8fd27e6a8fa03a17c6308572", async() => { BeginContext(1000, 441, true); WriteLiteral(@" <button class=""btn mb-3 summaryText-btn"" type=""submit"" onclick="""">Watch Preview<i class=""far fa-play-circle""></i></button> <button class=""btn mb-3 summaryText-btn"" type=""submit"" onclick="""">Share<i class=""fas fa-share""></i></button> <button class=""btn mb-3 summaryText-btn"" type=""submit"" onclick="""">Wishlist<i class=""fas fa-heart""></i></button> "); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1448, 568, true); WriteLiteral(@" </div> </div> </div> </div> <div class=""sub-summary""> <div class=""container-fluid""> <div class=""row""> <div class=""col-md-4 sub-summary-content""> <span class=""badge badge-best-seller"">Best seller</span> <div class=""my-rating""></div><span>5 (1,502)</span><span class=""time""><i class=""far fa-clock""></i>2h 46m</span> </div> <div class=""col-md-8 sub-summary-content-author""> "); EndContext(); BeginContext(2016, 94, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("img", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "1841d92595fecf85ccad8fd27e6a8fa03a17c63011152", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_4); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(2110, 985, true); WriteLiteral(@" <div class=""author-profile"">Created by <span style=""color: #006666; font-weight: bold;"">Stephen Oloto</span></div> </div> </div> </div> </div> </section> <div id=""content""> <!-- Begin Page Content --> <div class=""main-content""> <div class=""container-fluid""> <div class=""preview-section spad""> <!-- <div class=""row""> <div class=""col-md-12""> <div class=""section-title""> <h2>Edit Course</h2> </div> </div> </div> --> <div class=""row""> <div class=""col-md-7 p-0""> <div class=""section-subtitle d-flex""> <h3>Course Content</h3><div class=""side-line""></div> </div> <div id=""accordion"" class=""mt-3 accordion""> "); EndContext(); #line 69 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CoursePreview.cshtml" if (ViewBag.CourseTopicInfo != null) { #line default #line hidden #line 71 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CoursePreview.cshtml" foreach (var courses in ViewBag.CourseTopicInfo) { #line default #line hidden BeginContext(3311, 269, true); WriteLiteral(@" <div class=""card border-2 mb-0 mb-5 shadow""> <div class=""card-header collapsed"" data-toggle=""collapse"" href=""#collapseOne""> <a class=""card-title""> "); EndContext(); BeginContext(3581, 13, false); #line 75 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CoursePreview.cshtml" Write(courses.topic); #line default #line hidden EndContext(); BeginContext(3594, 1031, true); WriteLiteral(@" </a> </div> <div id=""collapseOne"" class=""card-body p-0 collapse moreCollapse"" data-parent=""#accordion""> <ul class=""section_menu"" aria-labelledby=""userDropdown""> <li class=""section-item""> <a href=""#"" class=""d-inline""> <i class=""far fa-play-circle fa-fw mr-2""></i> Course Introduction <p style=""float: right; margin: 0px; font-size:14px;color:rgba(0, 0, 0, 0.5);"">5m 24s</p> </a> </li> </ul> </div> <"); WriteLiteral("/div>\r\n"); EndContext(); #line 89 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CoursePreview.cshtml" } #line default #line hidden #line 89 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CoursePreview.cshtml" } #line default #line hidden BeginContext(5939, 3399, true); WriteLiteral(@" <!--<div class=""card border-2 mb-0 mb-5 shadow""> <div class=""card-header collapsed"" data-toggle=""collapse"" data-parent=""#accordion"" href=""#collapseTwo""> <a class=""card-title""> Getting Started with UX Design </a> </div> <div id=""collapseTwo"" class=""card-body p-0 collapse moreCollapse"" data-parent=""#accordion"">--> <!-- Dropdown - User Information --> <!--<ul class=""section_menu"" aria-labelledby=""userDropdown""> <li class=""section-item""> <a href=""#"" class=""d-inline""> <span class=""fs-20 material-icons mr-2""> ondemand_video </span>--> <!-- <i class=""fas fa-grip-lines fa-sm fa"); WriteLiteral(@"-fw mr-2 text-gray-400""></i> --> <!-- <i class=""fas fa-user fa-sm fa-fw mr-2 text-gray-400""></i> --> <!--Introduction to Adobe XD <p style=""float: right; margin: 0px; font-size:14px;color:rgba(0, 0, 0, 0.5);"">5m 24s</p> </a> </li>--> <!-- <div class=""dropdown-divider""></div> --> <!--<li class=""section-item""> <a href=""#"" class=""d-inline""> <i class=""far fa-file fa-fw mr-2""></i> The Artboard and its Components <p style=""float: right; margin: 0px; font-size:14px;color:rgba(0, 0, 0, 0.5);"">42m 14s</p> </a> </li>--> <!-- <div class=""dropdown-divider""></div> --> "); WriteLiteral(@" <!--<li class=""section-item""> <a href=""#"" class=""d-inline""> <i class=""far fa-play-circle fa-fw mr-2""></i>--> <!-- <i class=""fas fa-grip-lines fa-sm fa-fw mr-2 text-gray-400""></i> --> <!--Introduction to Mockups <p style=""float: right; margin: 0px; font-size:14px;color:rgba(0, 0, 0, 0.5);"">28m 4s</p> </a> </li>--> <!-- <div class=""dropdown-divider""></div> --> <!--<li class=""section-item no-border""> <a href=""#"" class=""d-inline"" data-toggle=""modal"" data-target=""#logoutModal""> <i class=""far fa-question-circle fa-fw mr-2""></i> Chapter 1 Quiz "); WriteLiteral(@" <p style=""float: right; margin: 0px; font-size:14px;color:rgba(0, 0, 0, 0.5);"">1hr 24m 5s</p> </a> </li> </ul> </div> </div>--> "); EndContext(); BeginContext(12472, 4867, true); WriteLiteral(@" </div> <button class=""btn mb-3 soft-btn"" type=""submit"" onclick=""createSection();"">6 more Sections</button> </div> <div class=""col-md-5""> <div class=""option-section shadow""> <h3 class=""option-item mb-3"">₦100, 000</h3> <a class=""option-item d-flex justify-content-center"" href=""#""> <button id=""submit"" type=""submit"" class=""w-100 btn btn-danger ibtn"">Add to cart</button> </a> <a class=""option-item d-flex justify-content-center"" href=""#""> <button class=""btn mb-3 soft-btn"" type=""submit"" onclick=""createSection();"">Buy now</button> </a> <p class=""option-item text-center text-gray-900"">30-Day Money-Back Guarantee</p> <div class=""option"); WriteLiteral(@"-item""> <h6 class=""font-weight-bold""> What This Course Includes : </h6> <ul class=""option-item-includes""> <li> <span class=""fs-20 material-icons mr-2"">ondemand_video</span> 8 hours on-demand video </li> <li> <i class=""far fa-file fa-fw mr-2""></i> 32 articles </li> <li> <span class=""fs-20 material-icons mr-2"">cloud_download</span> 65 downloadable resources </li> <li> <span class=""fs-20 material-icons mr-2"">t"); WriteLiteral(@"imeline</span> Full lifetime access </li> <li> <i class=""fas fa-mobile-alt fa-fw mr-2""></i> Access on mobile and TV </li> <li> <i class=""fas fa-graduation-cap fa-fw mr-2""></i> Certificate of completion </li> </ul> </div> <a href=""#"" id=""hide""><p class=""option-item text-center couponText"">Apply Coupon</p></a> <div id=""Create"" style=""display:none"" class=""couponDiv""> <div class=""input-group""> <input type=""text"" class=""form-control"" placeholder"); WriteLiteral(@"=""Enter Code"" aria-label=""Recipient's username"" aria-describedby=""basic-addon2""> <div class=""input-group-append""> <button class=""btn btn-outline-secondary"" type=""button"">Continue</button> </div> </div> <a href=""#"" id=""show"" class=""option-item text-danger"">Cancel</a> </div> <div class=""dropdown-divider""></div> <div class=""option-item mt-3""> <h6 class=""font-weight-bold"">Training more than Four People ?</h6> <p class=""t-wrap text-gray-500"">Get your team access to SoftLearn's top 4, 000+ courses anytime, anywhere.</p> <a class=""option-item d-flex justify-content-center"" href=""#""> <button class=""btn mb-3 soft-btn"" t"); WriteLiteral(@"ype=""submit"" onclick=""createSection();"">Get SoftLearn for Schools</button> </a> </div> </div> </div> </div> </div> </div> </div> <div class=""description-content content-alignment""> <div class=""container-fluid""> <div class=""description-section spad""> <div class=""row""> <div class=""col-md-7 p-0""> <div class=""section-subtitle mb-5 d-flex""> <h3>Course Description</h3><div class=""side-line""></div> </div> <article> <p>"); EndContext(); BeginContext(17340, 36, false); #line 276 "C:\Users\Nonso\source\repos\NewSoftlearn\NewSoftlearn\Views\Learner\CoursePreview.cshtml" Write(ViewBag.CourseInfo.courseDescription); #line default #line hidden EndContext(); BeginContext(17376, 85, true); WriteLiteral("</p>\r\n <!-- <div id=\"collapse\" style=\"display:none\"> -->\r\n"); EndContext(); BeginContext(17797, 1838, true); WriteLiteral(@" <!-- </div> --> <!-- <a href=""#collapse"" class=""nav-toggle"" style=""color: #006666; font-size: 14px; font-weight: bold;"">Show More<i class=""fas fa-chevron-down""></i></a> --> </article> <!-- <a href=""#"">Read More</a> --> </div> </div> </div> </div> </div> <div class=""about-author-content content-alignment""> <div class=""container-fluid""> <div class=""about-author-section spad""> <div class=""row""> <div class=""col-md-7 p-0""> <div class=""section-subtitle mb-1""> <h3 class=""mb-3"">About the author</h3> <p>Stephen is a software developer at Telnet. With more than 20 years of software development experience, he has gained a passion for Agile software development -- especially Mean.</p> "); WriteLiteral(@" </div> <div class=""section-subtitle mb-5 d-flex""> <h5>More From the Author</h5><div class=""side-line""></div> </div> <ul class=""more-course-list""> <li class="" mb-4""> <div class=""card shadow""> <div class=""card-body p-0""> <div class=""col p-0""> <div class=""row no-gutters align-items-center""> <div class=""col-md-4 p-0""> <div class=""more-courses b-radius""> "); EndContext(); BeginContext(19635, 37, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("img", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "1841d92595fecf85ccad8fd27e6a8fa03a17c63027743", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_5); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(19672, 4131, true); WriteLiteral(@" </div> </div> <div class=""col-md-8 rpad""> <div class=""row""> <div class=""col-md-8""> <div class=""h4 mb-3 font-weight-bold"">Learn Figma</div> <p class=""text-gray-700"">Madison</p> <div class=""course-tags mb-4""> <div class=""my-rating""></div><span>5 (1,502)</span> </div> <div class=""badge badge-best-seller"">Best seller</div> </d"); WriteLiteral(@"iv> <div class=""col-md-4""> <h3 class=""text-right"">₦75, 000</h3> </div> </div> </div> </div> </div> </div> </div> </li> <li class="" mb-4""> <div class=""card shadow mb-3""> <div class=""card-body p-0""> <div class=""col p-0""> <div class=""row no-gutters align-items-center""> <div class=""col-md-4 p-0""> "); WriteLiteral(@" <div class=""more-courses b-radius""> <img src=""../dist2/img/courses/6.jpg""> </div> </div> <div class=""col-md-8 rpad""> <div class=""row""> <div class=""col-md-8""> <div class=""h4 mb-3 font-weight-bold"">Learn Figma</div> <p class=""text-gray-700"">Madison</p> <div class=""course-tags mb-4""> <div class=""my-rating""></div><span>5 (1,502)</span> </div> "); WriteLiteral(@" <div class=""badge badge-best-seller"">Best seller</div> </div> <div class=""col-md-4""> <h3 class=""text-right"">₦75, 000</h3> </div> </div> </div> </div> </div> </div> </div> </li> </ul> <a href=""#"" style=""color: #006666; font-size: 16px; font-weight: bold;"">View all</a> </div> <div class=""col-md-5 p-0""> <div class=""section-author-profile text-cen"); WriteLiteral("ter\">\r\n "); EndContext(); BeginContext(23803, 95, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("img", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "1841d92595fecf85ccad8fd27e6a8fa03a17c63033241", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_6); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_7); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_4); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(23898, 390, true); WriteLiteral(@" <h4>Stephen Oloto</h4> <p>Angular, Web Development</p> <button class=""btn mb-3 soft-iprofile-btn"" type=""submit"" onclick=""createSection();"">View Profile</button> </div> </div> </div> </div> </div> </div> </div>"); EndContext(); }
public HttpClientNetworkDriver(IOptions <HttpClientConfig> options, ILogger <HttpClientNetworkDriver> logger, System.Net.Http.HttpClient client) { _config = options.Value; _logger = logger; _client = client; }