mirror of https://github.com/Squidex/squidex.git
1 changed files with 40 additions and 0 deletions
@ -0,0 +1,40 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
||||
|
// All rights reserved. Licensed under the MIT license.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using System.Collections.Generic; |
||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.AspNetCore.Mvc.Abstractions; |
||||
|
using Microsoft.AspNetCore.Mvc.Filters; |
||||
|
using Microsoft.AspNetCore.Routing; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Squidex.Web |
||||
|
{ |
||||
|
public class UrlDecodeRouteParamsAttributeTests |
||||
|
{ |
||||
|
[Fact] |
||||
|
public void Should_url_decode_params() |
||||
|
{ |
||||
|
var sut = new UrlDecodeRouteParamsAttribute(); |
||||
|
|
||||
|
var actionContext = new ActionContext(new DefaultHttpContext(), new RouteData(), new ActionDescriptor |
||||
|
{ |
||||
|
FilterDescriptors = new List<FilterDescriptor>() |
||||
|
}); |
||||
|
|
||||
|
var actionExecutingContext = new ActionExecutingContext(actionContext, new List<IFilterMetadata>(), new Dictionary<string, object> |
||||
|
{ |
||||
|
["key"] = "path%2Fto%2Fsomething" |
||||
|
}, null!); |
||||
|
|
||||
|
sut.OnActionExecuting(actionExecutingContext); |
||||
|
|
||||
|
Assert.Equal("path/to/something", actionExecutingContext.ActionArguments["key"]); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue