TestController.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Jellyfin.Api.Constants;
  4. using Microsoft.AspNetCore.Authorization;
  5. using Microsoft.AspNetCore.Http;
  6. using Microsoft.AspNetCore.Mvc;
  7. namespace Jellyfin.Api.Controllers
  8. {
  9. /// <summary>
  10. /// Controller for testing.
  11. /// </summary>
  12. [Route("Tests")]
  13. public class TestController : BaseJellyfinApiController
  14. {
  15. /// <summary>
  16. /// Initializes a new instance of the <see cref="TestController"/> class.
  17. /// </summary>
  18. public TestController()
  19. {
  20. }
  21. /// <summary>
  22. /// Tests the url decoding.
  23. /// </summary>
  24. /// <param name="params">Parameters to echo back in the response.</param>
  25. /// <returns>An <see cref="OkResult"/>.</returns>
  26. /// <response code="200">Information retrieved.</response>
  27. [HttpGet("Decoding", Name = "TestUrlDecoding")]
  28. [ProducesResponseType(StatusCodes.Status200OK)]
  29. public ActionResult TestUrlDecoding([FromQuery]Dictionary<string, string>? @params = null)
  30. {
  31. if (@params != null && @params.Count > 0)
  32. {
  33. Response.Headers.Add("querystring", string.Join("&", @params.Select(x => x.Key + "=" + x.Value)));
  34. }
  35. return Ok();
  36. }
  37. }
  38. }