EncoderController.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Microsoft.AspNetCore.Http;
  4. using Microsoft.AspNetCore.Mvc;
  5. namespace Jellyfin.Api.Controllers
  6. {
  7. /// <summary>
  8. /// Controller for testing the encoded url.
  9. /// </summary>
  10. public class EncoderController : BaseJellyfinApiController
  11. {
  12. /// <summary>
  13. /// Tests the url decoding.
  14. /// </summary>
  15. /// <param name="params">Parameters to echo back in the response.</param>
  16. /// <returns>An <see cref="OkResult"/>.</returns>
  17. /// <response code="200">Information retrieved.</response>
  18. [HttpGet("UrlDecode")]
  19. [ProducesResponseType(StatusCodes.Status200OK)]
  20. public ContentResult TestUrlDecoding([FromQuery] Dictionary<string, string>? @params = null)
  21. {
  22. return new ContentResult()
  23. {
  24. Content = (@params != null && @params.Count > 0)
  25. ? string.Join("&", @params.Select(x => x.Key + "=" + x.Value))
  26. : string.Empty,
  27. ContentType = "text/plain; charset=utf-8",
  28. StatusCode = 200
  29. };
  30. }
  31. }
  32. }