Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

40 lines
1.4 KiB

// ==========================================================================
// 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"]);
}
}
}