mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-20 02:28:31 +01:00
24 lines
625 B
C#
24 lines
625 B
C#
using Microsoft.AspNetCore.Routing;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace BTCPayServer.Hosting
|
|
{
|
|
public class LowercaseTransformer : IOutboundParameterTransformer
|
|
{
|
|
public static void Register(IServiceCollection services)
|
|
{
|
|
services.AddRouting(opts =>
|
|
{
|
|
opts.ConstraintMap["lowercase"] = typeof(LowercaseTransformer);
|
|
});
|
|
}
|
|
|
|
public string TransformOutbound(object value)
|
|
{
|
|
if (value is not string str)
|
|
return null;
|
|
return str.ToLowerInvariant();
|
|
}
|
|
}
|
|
}
|