EncoderController.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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 the encoded url.
  11. /// </summary>
  12. public class EncoderController : BaseJellyfinApiController
  13. {
  14. /// <summary>
  15. /// Tests the url decoding.
  16. /// </summary>
  17. /// <param name="params">Parameters to echo back in the response.</param>
  18. /// <returns>An <see cref="OkResult"/>.</returns>
  19. /// <response code="200">Information retrieved.</response>
  20. [HttpGet("UrlDecode")]
  21. [ProducesResponseType(StatusCodes.Status200OK)]
  22. public ContentResult TestUrlDecoding([FromQuery]Dictionary<string, string>? @params = null)
  23. {
  24. return new ContentResult()
  25. {
  26. Content = (@params != null && @params.Count > 0)
  27. ? string.Join("&", @params.Select(x => x.Key + "=" + x.Value))
  28. : string.Empty,
  29. ContentType = "text/plain; charset=utf-8",
  30. StatusCode = 200
  31. };
  32. }
  33. }
  34. }