Fix failing functional tests
This commit is contained in:
parent
fec1268bf3
commit
432cfa0035
|
|
@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||||
Assert.Equal(
|
Assert.Equal(
|
||||||
"Hello, Anonymous User from WebApiCompatShimWebSite.BasicApiController.WriteToHttpContext",
|
"Hello, Anonymous User from WebApiCompatShimWebSite.BasicApiController.WriteToHttpContext (WebApiCompatShimWebSite)",
|
||||||
content);
|
content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
|
||||||
namespace FiltersWebSite
|
namespace FiltersWebSite
|
||||||
|
|
@ -11,7 +13,9 @@ namespace FiltersWebSite
|
||||||
{
|
{
|
||||||
public override void OnAuthorization(AuthorizationFilterContext context)
|
public override void OnAuthorization(AuthorizationFilterContext context)
|
||||||
{
|
{
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ProductsController.GetPrice")
|
var controllerActionDescriptor = (ControllerActionDescriptor)context.ActionDescriptor;
|
||||||
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ProductsController).GetMethod(nameof(ProductsController.GetPrice)))
|
||||||
{
|
{
|
||||||
context.HttpContext.Response.Headers.Append("filters",
|
context.HttpContext.Response.Headers.Append("filters",
|
||||||
"Authorize Filter On Action - OnAuthorization");
|
"Authorize Filter On Action - OnAuthorization");
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
|
||||||
namespace FiltersWebSite
|
namespace FiltersWebSite
|
||||||
|
|
@ -16,7 +18,9 @@ namespace FiltersWebSite
|
||||||
|
|
||||||
public override void OnActionExecuting(ActionExecutingContext context)
|
public override void OnActionExecuting(ActionExecutingContext context)
|
||||||
{
|
{
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ActionFilterController.GetHelloWorld")
|
var controllerActionDescriptor = (ControllerActionDescriptor)context.ActionDescriptor;
|
||||||
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ActionFilterController).GetMethod(nameof(ActionFilterController.GetHelloWorld)))
|
||||||
{
|
{
|
||||||
(context.ActionArguments["fromGlobalActionFilter"] as List<ContentResult>).
|
(context.ActionArguments["fromGlobalActionFilter"] as List<ContentResult>).
|
||||||
Add(Helpers.GetContentResult(context.Result, "Action Filter - OnActionExecuting"));
|
Add(Helpers.GetContentResult(context.Result, "Action Filter - OnActionExecuting"));
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
|
||||||
namespace FiltersWebSite
|
namespace FiltersWebSite
|
||||||
|
|
@ -12,7 +14,9 @@ namespace FiltersWebSite
|
||||||
{
|
{
|
||||||
public override void OnActionExecuted(ActionExecutedContext context)
|
public override void OnActionExecuted(ActionExecutedContext context)
|
||||||
{
|
{
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ProductsController.GetPrice")
|
var controllerActionDescriptor = (ControllerActionDescriptor)context.ActionDescriptor;
|
||||||
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ProductsController).GetMethod(nameof(ProductsController.GetPrice)))
|
||||||
{
|
{
|
||||||
context.HttpContext.Response.Headers.Append("filters",
|
context.HttpContext.Response.Headers.Append("filters",
|
||||||
"On Controller Action Filter - OnActionExecuted");
|
"On Controller Action Filter - OnActionExecuted");
|
||||||
|
|
@ -25,13 +29,16 @@ namespace FiltersWebSite
|
||||||
|
|
||||||
public override void OnActionExecuting(ActionExecutingContext context)
|
public override void OnActionExecuting(ActionExecutingContext context)
|
||||||
{
|
{
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ProductsController.GetPrice")
|
var controllerActionDescriptor = (ControllerActionDescriptor)context.ActionDescriptor;
|
||||||
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ProductsController).GetMethod(nameof(ProductsController.GetPrice)))
|
||||||
{
|
{
|
||||||
context.HttpContext.Response.Headers.Append("filters",
|
context.HttpContext.Response.Headers.Append("filters",
|
||||||
"On Controller Action Filter - OnActionExecuting");
|
"On Controller Action Filter - OnActionExecuting");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ActionFilterController.GetHelloWorld")
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ActionFilterController).GetMethod(nameof(ActionFilterController.GetHelloWorld)))
|
||||||
{
|
{
|
||||||
(context.ActionArguments["fromGlobalActionFilter"] as List<ContentResult>)
|
(context.ActionArguments["fromGlobalActionFilter"] as List<ContentResult>)
|
||||||
.Add(Helpers.GetContentResult(context.Result, "Controller Action filter - OnActionExecuting"));
|
.Add(Helpers.GetContentResult(context.Result, "Controller Action filter - OnActionExecuting"));
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
|
||||||
namespace FiltersWebSite
|
namespace FiltersWebSite
|
||||||
|
|
@ -10,7 +12,9 @@ namespace FiltersWebSite
|
||||||
{
|
{
|
||||||
public override void OnResultExecuting(ResultExecutingContext context)
|
public override void OnResultExecuting(ResultExecutingContext context)
|
||||||
{
|
{
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ProductsController.GetPrice")
|
var controllerActionDescriptor = (ControllerActionDescriptor)context.ActionDescriptor;
|
||||||
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ProductsController).GetMethod(nameof(ProductsController.GetPrice)))
|
||||||
{
|
{
|
||||||
context.HttpContext.Response.Headers.Append("filters",
|
context.HttpContext.Response.Headers.Append("filters",
|
||||||
"On Controller Result Filter - OnResultExecuting");
|
"On Controller Result Filter - OnResultExecuting");
|
||||||
|
|
@ -23,7 +27,9 @@ namespace FiltersWebSite
|
||||||
|
|
||||||
public override void OnResultExecuted(ResultExecutedContext context)
|
public override void OnResultExecuted(ResultExecutedContext context)
|
||||||
{
|
{
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ProductsController.GetPrice")
|
var controllerActionDescriptor = (ControllerActionDescriptor)context.ActionDescriptor;
|
||||||
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ProductsController).GetMethod(nameof(ProductsController.GetPrice)))
|
||||||
{
|
{
|
||||||
context.HttpContext.Response.Headers.Append("filters",
|
context.HttpContext.Response.Headers.Append("filters",
|
||||||
"On Controller Result Filter - OnResultExecuted");
|
"On Controller Result Filter - OnResultExecuted");
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,10 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
|
||||||
namespace FiltersWebSite
|
namespace FiltersWebSite
|
||||||
|
|
@ -12,12 +14,15 @@ namespace FiltersWebSite
|
||||||
{
|
{
|
||||||
public void OnActionExecuted(ActionExecutedContext context)
|
public void OnActionExecuted(ActionExecutedContext context)
|
||||||
{
|
{
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ActionFilterController.GetHelloWorld")
|
var controllerActionDescriptor = (ControllerActionDescriptor)context.ActionDescriptor;
|
||||||
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ActionFilterController).GetMethod(nameof(ActionFilterController.GetHelloWorld)))
|
||||||
{
|
{
|
||||||
context.Result = Helpers.GetContentResult(context.Result, "GlobalActionFilter.OnActionExecuted");
|
context.Result = Helpers.GetContentResult(context.Result, "GlobalActionFilter.OnActionExecuted");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ProductsController.GetPrice")
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ProductsController).GetMethod(nameof(ProductsController.GetPrice)))
|
||||||
{
|
{
|
||||||
context.HttpContext.Response.Headers.Append("filters",
|
context.HttpContext.Response.Headers.Append("filters",
|
||||||
"Global Action Filter - OnActionExecuted");
|
"Global Action Filter - OnActionExecuted");
|
||||||
|
|
@ -26,13 +31,16 @@ namespace FiltersWebSite
|
||||||
|
|
||||||
public void OnActionExecuting(ActionExecutingContext context)
|
public void OnActionExecuting(ActionExecutingContext context)
|
||||||
{
|
{
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ActionFilterController.GetHelloWorld")
|
var controllerActionDescriptor = (ControllerActionDescriptor)context.ActionDescriptor;
|
||||||
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ActionFilterController).GetMethod(nameof(ActionFilterController.GetHelloWorld)))
|
||||||
{
|
{
|
||||||
(context.ActionArguments["fromGlobalActionFilter"] as List<ContentResult>)
|
(context.ActionArguments["fromGlobalActionFilter"] as List<ContentResult>)
|
||||||
.Add(Helpers.GetContentResult(null, "GlobalActionFilter.OnActionExecuting"));
|
.Add(Helpers.GetContentResult(null, "GlobalActionFilter.OnActionExecuting"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ProductsController.GetPrice")
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ProductsController).GetMethod(nameof(ProductsController.GetPrice)))
|
||||||
{
|
{
|
||||||
context.HttpContext.Response.Headers.Append("filters",
|
context.HttpContext.Response.Headers.Append("filters",
|
||||||
"Global Action Filter - OnActionExecuting");
|
"Global Action Filter - OnActionExecuting");
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
|
||||||
namespace FiltersWebSite
|
namespace FiltersWebSite
|
||||||
|
|
@ -10,7 +12,9 @@ namespace FiltersWebSite
|
||||||
{
|
{
|
||||||
public override void OnAuthorization(AuthorizationFilterContext context)
|
public override void OnAuthorization(AuthorizationFilterContext context)
|
||||||
{
|
{
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ProductsController.GetPrice")
|
var controllerActionDescriptor = (ControllerActionDescriptor)context.ActionDescriptor;
|
||||||
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ProductsController).GetMethod(nameof(ProductsController.GetPrice)))
|
||||||
{
|
{
|
||||||
context.HttpContext.Response.Headers.Append("filters",
|
context.HttpContext.Response.Headers.Append("filters",
|
||||||
"Global Authorization Filter - OnAuthorization");
|
"Global Authorization Filter - OnAuthorization");
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
|
||||||
namespace FiltersWebSite
|
namespace FiltersWebSite
|
||||||
|
|
@ -10,7 +12,9 @@ namespace FiltersWebSite
|
||||||
{
|
{
|
||||||
public void OnResultExecuted(ResultExecutedContext context)
|
public void OnResultExecuted(ResultExecutedContext context)
|
||||||
{
|
{
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ProductsController.GetPrice")
|
var controllerActionDescriptor = (ControllerActionDescriptor)context.ActionDescriptor;
|
||||||
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ProductsController).GetMethod(nameof(ProductsController.GetPrice)))
|
||||||
{
|
{
|
||||||
context.HttpContext.Response.Headers.Append("filters",
|
context.HttpContext.Response.Headers.Append("filters",
|
||||||
"Global Result Filter - OnResultExecuted");
|
"Global Result Filter - OnResultExecuted");
|
||||||
|
|
@ -19,12 +23,15 @@ namespace FiltersWebSite
|
||||||
|
|
||||||
public void OnResultExecuting(ResultExecutingContext context)
|
public void OnResultExecuting(ResultExecutingContext context)
|
||||||
{
|
{
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ResultFilterController.GetHelloWorld")
|
var controllerActionDescriptor = (ControllerActionDescriptor)context.ActionDescriptor;
|
||||||
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ResultFilterController).GetMethod(nameof(ResultFilterController.GetHelloWorld)))
|
||||||
{
|
{
|
||||||
context.Result = Helpers.GetContentResult(context.Result, "GlobalResultFilter.OnResultExecuting");
|
context.Result = Helpers.GetContentResult(context.Result, "GlobalResultFilter.OnResultExecuting");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ProductsController.GetPrice")
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ProductsController).GetMethod(nameof(ProductsController.GetPrice)))
|
||||||
{
|
{
|
||||||
context.HttpContext.Response.Headers.Append("filters",
|
context.HttpContext.Response.Headers.Append("filters",
|
||||||
"Global Result Filter - OnResultExecuted");
|
"Global Result Filter - OnResultExecuted");
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
|
||||||
namespace FiltersWebSite
|
namespace FiltersWebSite
|
||||||
|
|
@ -10,7 +12,9 @@ namespace FiltersWebSite
|
||||||
{
|
{
|
||||||
public override void OnResultExecuting(ResultExecutingContext context)
|
public override void OnResultExecuting(ResultExecutingContext context)
|
||||||
{
|
{
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ProductsController.GetPrice")
|
var controllerActionDescriptor = (ControllerActionDescriptor)context.ActionDescriptor;
|
||||||
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ProductsController).GetMethod(nameof(ProductsController.GetPrice)))
|
||||||
{
|
{
|
||||||
context.HttpContext.Response.Headers.Append("filters",
|
context.HttpContext.Response.Headers.Append("filters",
|
||||||
"On Action Result Filter - OnResultExecuting");
|
"On Action Result Filter - OnResultExecuting");
|
||||||
|
|
@ -19,7 +23,9 @@ namespace FiltersWebSite
|
||||||
|
|
||||||
public override void OnResultExecuted(ResultExecutedContext context)
|
public override void OnResultExecuted(ResultExecutedContext context)
|
||||||
{
|
{
|
||||||
if (context.ActionDescriptor.DisplayName == "FiltersWebSite.ProductsController.GetPrice")
|
var controllerActionDescriptor = (ControllerActionDescriptor)context.ActionDescriptor;
|
||||||
|
if (controllerActionDescriptor.MethodInfo ==
|
||||||
|
typeof(ProductsController).GetMethod(nameof(ProductsController.GetPrice)))
|
||||||
{
|
{
|
||||||
context.HttpContext.Response.Headers.Append("filters",
|
context.HttpContext.Response.Headers.Append("filters",
|
||||||
"On Action Result Filter - OnResultExecuted");
|
"On Action Result Filter - OnResultExecuted");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue