Fix test websites
This commit is contained in:
parent
77d9b41e48
commit
6333c12d77
|
|
@ -56,7 +56,7 @@ namespace ContentNegotiationWebSite
|
||||||
var optionsAccessor = ActionContext.HttpContext.RequestServices
|
var optionsAccessor = ActionContext.HttpContext.RequestServices
|
||||||
.GetRequiredService<IOptions<MvcOptions>>();
|
.GetRequiredService<IOptions<MvcOptions>>();
|
||||||
objectResult.Formatters.Add(new HttpNotAcceptableOutputFormatter());
|
objectResult.Formatters.Add(new HttpNotAcceptableOutputFormatter());
|
||||||
foreach (var formatter in optionsAccessor.Options.OutputFormatters)
|
foreach (var formatter in optionsAccessor.Value.OutputFormatters)
|
||||||
{
|
{
|
||||||
objectResult.Formatters.Add(formatter);
|
objectResult.Formatters.Add(formatter);
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +74,7 @@ namespace ContentNegotiationWebSite
|
||||||
objectResult.Formatters.Add(new HttpNotAcceptableOutputFormatter());
|
objectResult.Formatters.Add(new HttpNotAcceptableOutputFormatter());
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var formatter in optionsAccessor.Options.OutputFormatters)
|
foreach (var formatter in optionsAccessor.Value.OutputFormatters)
|
||||||
{
|
{
|
||||||
objectResult.Formatters.Add(formatter);
|
objectResult.Formatters.Add(formatter);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace FiltersWebSite
|
||||||
IUrlEncoder encoder,
|
IUrlEncoder encoder,
|
||||||
string authScheme) :
|
string authScheme) :
|
||||||
base(next, options, loggerFactory, encoder,
|
base(next, options, loggerFactory, encoder,
|
||||||
new ConfigureOptions<BasicOptions>(o => o.AuthenticationScheme = authScheme) { Name = authScheme })
|
new ConfigureOptions<BasicOptions>(o => o.AuthenticationScheme = authScheme))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace FiltersWebSite
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
services.ConfigureAuthorization(options =>
|
services.AddAuthorization(options =>
|
||||||
{
|
{
|
||||||
// This policy cannot succeed since the claim is never added
|
// This policy cannot succeed since the claim is never added
|
||||||
options.AddPolicy("Impossible", policy =>
|
options.AddPolicy("Impossible", policy =>
|
||||||
|
|
@ -43,8 +43,6 @@ namespace FiltersWebSite
|
||||||
services.AddSingleton<RandomNumberFilter>();
|
services.AddSingleton<RandomNumberFilter>();
|
||||||
services.AddSingleton<RandomNumberService>();
|
services.AddSingleton<RandomNumberService>();
|
||||||
services.AddTransient<IAuthorizationHandler, ManagerHandler>();
|
services.AddTransient<IAuthorizationHandler, ManagerHandler>();
|
||||||
services.Configure<BasicOptions>(o => o.AuthenticationScheme = "Api", "Api");
|
|
||||||
services.Configure<BasicOptions>(o => o.AuthenticationScheme = "Interactive", "Interactive");
|
|
||||||
|
|
||||||
services.Configure<MvcOptions>(options =>
|
services.Configure<MvcOptions>(options =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,12 @@ namespace UrlHelperWebSite
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override string Content(string contentPath)
|
public override string Content(string contentPath)
|
||||||
{
|
{
|
||||||
if (_appOptions.Options.ServeCDNContent
|
if (_appOptions.Value.ServeCDNContent
|
||||||
&& contentPath.StartsWith("~/", StringComparison.Ordinal))
|
&& contentPath.StartsWith("~/", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
var segment = new PathString(contentPath.Substring(1));
|
var segment = new PathString(contentPath.Substring(1));
|
||||||
|
|
||||||
return ConvertToLowercaseUrl(_appOptions.Options.CDNServerBaseUrl + segment);
|
return ConvertToLowercaseUrl(_appOptions.Value.CDNServerBaseUrl + segment);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConvertToLowercaseUrl(base.Content(contentPath));
|
return ConvertToLowercaseUrl(base.Content(contentPath));
|
||||||
|
|
@ -61,7 +61,7 @@ namespace UrlHelperWebSite
|
||||||
private string ConvertToLowercaseUrl(string url)
|
private string ConvertToLowercaseUrl(string url)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(url)
|
if (!string.IsNullOrEmpty(url)
|
||||||
&& _appOptions.Options.GenerateLowercaseUrls)
|
&& _appOptions.Value.GenerateLowercaseUrls)
|
||||||
{
|
{
|
||||||
return url.ToLowerInvariant();
|
return url.ToLowerInvariant();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ namespace WebApiCompatShimWebSite
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public string[] GetFormatters()
|
public string[] GetFormatters()
|
||||||
{
|
{
|
||||||
return OptionsAccessor.Options.Formatters.Select(f => f.GetType().FullName).ToArray();
|
return OptionsAccessor.Value.Formatters.Select(f => f.GetType().FullName).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue