Radarr/src/NzbDrone.Api/Profiles/LegacyProfileModule.cs

35 lines
828 B
C#
Raw Normal View History

2016-12-23 21:45:24 +00:00
using System.Text;
using Nancy;
namespace NzbDrone.Api.Profiles
{
2019-12-22 22:08:53 +00:00
public class LegacyProfileModule : NzbDroneApiModule
{
public LegacyProfileModule()
: base("qualityprofile")
{
2019-08-28 21:43:55 +00:00
Get("/", x =>
{
string queryString = ConvertQueryParams(Request.Query);
var url = string.Format("/api/profile?{0}", queryString);
return Response.AsRedirect(url);
2019-08-28 21:43:55 +00:00
});
}
private string ConvertQueryParams(DynamicDictionary query)
{
var sb = new StringBuilder();
foreach (var key in query)
{
var value = query[key];
sb.AppendFormat("&{0}={1}", key, value);
}
return sb.ToString().Trim('&');
}
}
}