소스 검색

Moved into test controller.

BaronGreenback 4 년 전
부모
커밋
af1fe1af6f

+ 1 - 7
Jellyfin.Api/Controllers/SystemController.cs

@@ -84,19 +84,13 @@ namespace Jellyfin.Api.Controllers
         /// <summary>
         /// Pings the system.
         /// </summary>
-        /// <param name="params">Optional: Parameters to echo back in the response.</param>
         /// <response code="200">Information retrieved.</response>
         /// <returns>The server name.</returns>
         [HttpGet("Ping", Name = "GetPingSystem")]
         [HttpPost("Ping", Name = "PostPingSystem")]
         [ProducesResponseType(StatusCodes.Status200OK)]
-        public ActionResult<string> PingSystem([FromQuery]Dictionary<string, string>? @params = null)
+        public ActionResult<string> PingSystem()
         {
-            if (@params != null && @params.Count > 0)
-            {
-                Response.Headers.Add("querystring", string.Join("&", @params.Select(x => x.Key + "=" + x.Value)));
-            }
-
             return _appHost.Name;
         }
 

+ 41 - 0
Jellyfin.Api/Controllers/TestController.cs

@@ -0,0 +1,41 @@
+using System.Collections.Generic;
+using System.Linq;
+using Jellyfin.Api.Constants;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Jellyfin.Api.Controllers
+{
+    /// <summary>
+    /// Controller for testing.
+    /// </summary>
+    [Route("Tests")]
+    public class TestController : BaseJellyfinApiController
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="TestController"/> class.
+        /// </summary>
+        public TestController()
+        {
+        }
+
+        /// <summary>
+        /// Tests the url decoding.
+        /// </summary>
+        /// <param name="params">Parameters to echo back in the response.</param>
+        /// <returns>An <see cref="OkResult"/>.</returns>
+        /// <response code="200">Information retrieved.</response>
+        [HttpGet("Decoding", Name = "TestUrlDecoding")]
+        [ProducesResponseType(StatusCodes.Status200OK)]
+        public ActionResult TestUrlDecoding([FromQuery]Dictionary<string, string>? @params = null)
+        {
+            if (@params != null && @params.Count > 0)
+            {
+                Response.Headers.Add("querystring", string.Join("&", @params.Select(x => x.Key + "=" + x.Value)));
+            }
+
+            return Ok();
+        }
+    }
+}

+ 1 - 1
tests/Jellyfin.Api.Tests/Controllers/EncodedQueryStringTest.cs

@@ -39,7 +39,7 @@ namespace Jellyfin.Api.Tests.Controllers
         {
             var client = _factory.CreateClient();
 
-            var response = await client.GetAsync("system/ping?" + sourceUrl).ConfigureAwait(false);
+            var response = await client.GetAsync("Tests/Decoding?" + sourceUrl).ConfigureAwait(false);
             Assert.Equal(HttpStatusCode.OK, response.StatusCode);
             Assert.Equal(unencodedUrl, response.Headers.GetValues("querystring").First());
         }