mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
changed
This commit is contained in:
parent
8b34f76b63
commit
dca0298710
@ -20,14 +20,16 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// <response code="200">Information retrieved.</response>
|
/// <response code="200">Information retrieved.</response>
|
||||||
[HttpGet("UrlDecode")]
|
[HttpGet("UrlDecode")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
public ActionResult TestUrlDecoding([FromQuery]Dictionary<string, string>? @params = null)
|
public ContentResult TestUrlDecoding([FromQuery]Dictionary<string, string>? @params = null)
|
||||||
{
|
{
|
||||||
if (@params != null && @params.Count > 0)
|
return new ContentResult()
|
||||||
{
|
{
|
||||||
Response.Headers.Add("querystring", string.Join("&", @params.Select(x => x.Key + "=" + x.Value)));
|
Content = (@params != null && @params.Count > 0)
|
||||||
}
|
? string.Join("&", @params.Select(x => x.Key + "=" + x.Value))
|
||||||
|
: string.Empty,
|
||||||
return Ok();
|
ContentType = "text/plain; charset=utf-8",
|
||||||
|
StatusCode = 200
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
@ -29,9 +30,10 @@ namespace Jellyfin.Api.Tests.Controllers
|
|||||||
{
|
{
|
||||||
var client = _factory.CreateClient();
|
var client = _factory.CreateClient();
|
||||||
|
|
||||||
var response = await client.GetAsync("Tests/Decoding?" + sourceUrl).ConfigureAwait(false);
|
var response = await client.GetAsync("Tests/UrlDecode?" + sourceUrl).ConfigureAwait(false);
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||||
Assert.Equal(unencodedUrl, response.Headers.GetValues("querystring").First());
|
string reply = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||||
|
Assert.Equal(unencodedUrl, reply);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user