mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +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();
|
||
|
}
|
||
|
}
|
||
|
}
|