Exemple #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            _env = env;
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Kolan API");
            });

            app.UseHttpsRedirection();
            app.UseRouting();
            app.UseAuthentication();
            app.UseAuthorization();
            app.UseDefaultFiles();
            app.UseStaticFiles();
            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "..",
                                                                     "node_modules/fa-icons")),
                RequestPath = new PathString("/node_modules/fa-icons")
            });
            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "..",
                                                                     "node_modules/@fortawesome/fontawesome-free/sprites")),
                RequestPath = new PathString("/node_modules/@fortawesome/fontawesome-free/sprites")
            });

            EndpointRoutingApplicationBuilderExtensions.UseEndpoints(
                app, endpoints =>
            {
                endpoints.MapControllerRoute(
                    "default",
                    "{controller=Boards}/{action=Index}/{id?}");

                endpoints.MapControllerRoute(
                    "api",
                    "api/{controller}/{action}/{id?}");

                endpoints.MapHub <BoardHub>("/hub");
            });
        }
        public async Task <HttpClient> GetTestClient()
        {
            var host = await new HostBuilder()
                       .ConfigureWebHost(webBuilder =>
            {
                webBuilder
                .UseTestServer()
                .ConfigureServices(services =>
                {
                    services
                    .AddMvcCore()
                    .AddControllersAsServices();

                    if (_useResponseCompression)
                    {
                        services.AddResponseCompression();
                    }
                })
                .Configure(app =>
                {
                    if (_useResponseCompression)
                    {
                        ResponseCompressionBuilderExtensions.UseResponseCompression(app);
                    }

                    if (_options == null)
                    {
                        ApplicationBuilderExtensions.UseBodilessResponses(app);
                    }
                    else
                    {
                        ApplicationBuilderExtensions.UseBodilessResponses(app, _options);
                    }

                    EndpointRoutingApplicationBuilderExtensions.UseRouting(app);
                    EndpointRoutingApplicationBuilderExtensions.UseEndpoints(app, endpoints =>
                    {
                        ControllerEndpointRouteBuilderExtensions.MapControllers(endpoints);
                    });
                });
            })
                       .StartAsync();

            var httpClient = host.GetTestClient();

            if (_header != null)
            {
                httpClient.DefaultRequestHeaders.Add(_header, _value);
            }

            return(httpClient);
        }
Exemple #3
0
 private void ConfigureTenantPipeline(IApplicationBuilder appBuilder)
 {
     V_0             = new ModularTenantRouterMiddleware.u003cu003ec__DisplayClass7_0();
     V_0.appBuilder  = appBuilder;
     V_0.startups    = ServiceProviderServiceExtensions.GetServices <IStartup>(V_0.appBuilder.get_ApplicationServices());
     stackVariable8  = V_0;
     stackVariable10 = V_0.startups;
     stackVariable11 = ModularTenantRouterMiddleware.u003cu003ec.u003cu003e9__7_0;
     if (stackVariable11 == null)
     {
         dummyVar0       = stackVariable11;
         stackVariable11 = new Func <IStartup, int>(ModularTenantRouterMiddleware.u003cu003ec.u003cu003e9.u003cConfigureTenantPipelineu003eb__7_0);
         ModularTenantRouterMiddleware.u003cu003ec.u003cu003e9__7_0 = stackVariable11;
     }
     stackVariable8.startups = stackVariable10.OrderBy <IStartup, int>(stackVariable11);
     dummyVar1 = EndpointRoutingApplicationBuilderExtensions.UseEndpoints(EndpointRoutingApplicationBuilderExtensions.UseRouting(V_0.appBuilder), new Action <IEndpointRouteBuilder>(V_0.u003cConfigureTenantPipelineu003eb__1));
     return;
 }