aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Api.Tests/Middleware/UrlDecodeQueryFeatureTests.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2023-10-22 17:01:51 +0200
committerGitHub <noreply@github.com>2023-10-22 09:01:51 -0600
commitb16033df03db7a6c3e3b3636c9eac4dad8e49f9d (patch)
tree1dc4bd20c2a28f13078040fd6036a65f2b615eb5 /tests/Jellyfin.Api.Tests/Middleware/UrlDecodeQueryFeatureTests.cs
parent028b2122ce39ec54bcab78ffd252a41518231458 (diff)
Fix fuzz projects (#10416)
Diffstat (limited to 'tests/Jellyfin.Api.Tests/Middleware/UrlDecodeQueryFeatureTests.cs')
-rw-r--r--tests/Jellyfin.Api.Tests/Middleware/UrlDecodeQueryFeatureTests.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/Jellyfin.Api.Tests/Middleware/UrlDecodeQueryFeatureTests.cs b/tests/Jellyfin.Api.Tests/Middleware/UrlDecodeQueryFeatureTests.cs
new file mode 100644
index 000000000..1ff7e7b7a
--- /dev/null
+++ b/tests/Jellyfin.Api.Tests/Middleware/UrlDecodeQueryFeatureTests.cs
@@ -0,0 +1,27 @@
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Http.Features;
+using Microsoft.Extensions.Primitives;
+using Xunit;
+
+namespace Jellyfin.Api.Middleware.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();
+ Assert.Equal(key, k);
+ Assert.True(StringValues.IsNullOrEmpty(v));
+ }
+ }
+}