TestController.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. public class TestsController : BaseJellyfinApiController
  13. {
  14. /// <summary>
  15. /// Initializes a new instance of the <see cref="TestController"/> class.
  16. /// </summary>
  17. public TestController()
  18. {
  19. }
  20. /// <summary>
  21. /// Tests the url decoding.
  22. /// </summary>
  23. /// <param name="params">Parameters to echo back in the response.</param>
  24. /// <returns>An <see cref="OkResult"/>.</returns>
  25. /// <response code="200">Information retrieved.</response>
  26. [HttpGet("UrlDecode")]
  27. [ProducesResponseType(StatusCodes.Status200OK)]
  28. public ActionResult TestUrlDecoding([FromQuery]Dictionary<string, string>? @params = null)
  29. {
  30. if (@params != null && @params.Count > 0)
  31. {
  32. Response.Headers.Add("querystring", string.Join("&", @params.Select(x => x.Key + "=" + x.Value)));
  33. }
  34. return Ok();
  35. }
  36. }
  37. }