jellyfin-server/Jellyfin.Api/Controllers/TestsController.cs

36 lines
1.2 KiB
C#
Raw Normal View History

2021-05-07 13:37:26 +00:00
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>
public class TestsController : BaseJellyfinApiController
2021-05-07 13:37:26 +00:00
{
/// <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("UrlDecode")]
2021-05-07 13:37:26 +00:00
[ProducesResponseType(StatusCodes.Status200OK)]
2021-05-07 19:11:32 +00:00
public ContentResult TestUrlDecoding([FromQuery]Dictionary<string, string>? @params = null)
2021-05-07 13:37:26 +00:00
{
2021-05-07 19:11:32 +00:00
return new ContentResult()
2021-05-07 13:37:26 +00:00
{
2021-05-07 19:11:32 +00:00
Content = (@params != null && @params.Count > 0)
? string.Join("&", @params.Select(x => x.Key + "=" + x.Value))
: string.Empty,
ContentType = "text/plain; charset=utf-8",
StatusCode = 200
};
2021-05-07 13:37:26 +00:00
}
}
}