2021-06-08 13:35:49 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
2023-01-14 02:37:37 +00:00
|
|
|
using Jellyfin.Api.Middleware;
|
2021-06-08 13:35:49 +00:00
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using Microsoft.AspNetCore.Http.Features;
|
|
|
|
using Microsoft.Extensions.Primitives;
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
namespace Jellyfin.Server.Tests
|
|
|
|
{
|
|
|
|
public static class UrlDecodeQueryFeatureTests
|
|
|
|
{
|
|
|
|
[Theory]
|
|
|
|
[InlineData("e0a72cb2a2c7", "e0a72cb2a2c7")] // isn't encoded
|
|
|
|
public static void EmptyValueTest(string query, string key)
|
|
|
|
{
|
|
|
|
var dict = new Dictionary<string, StringValues>
|
|
|
|
{
|
|
|
|
{ query, StringValues.Empty }
|
|
|
|
};
|
|
|
|
var test = new UrlDecodeQueryFeature(new QueryFeature(new QueryCollection(dict)));
|
|
|
|
Assert.Single(test.Query);
|
|
|
|
var (k, v) = test.Query.First();
|
2021-06-08 20:26:59 +00:00
|
|
|
Assert.Equal(key, k);
|
2023-09-01 15:35:57 +00:00
|
|
|
Assert.True(StringValues.IsNullOrEmpty(v));
|
2021-06-08 13:35:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|