roadie/Roadie.Api.Services/HttpEncoder.cs
2018-12-26 13:39:13 -06:00

34 lines
No EOL
801 B
C#

using Microsoft.AspNetCore.WebUtilities;
using Roadie.Library.Encoding;
using System.Web;
namespace Roadie.Api.Services
{
public class HttpEncoder : IHttpEncoder
{
public string HtmlEncode(string s)
{
return HttpUtility.HtmlEncode(s);
}
public string UrlDecode(string s)
{
return HttpUtility.UrlDecode(s);
}
public string UrlEncode(string s)
{
return HttpUtility.UrlEncode(s);
}
public string UrlEncodeBase64(byte[] input)
{
return WebEncoders.Base64UrlEncode(input);
}
public string UrlEncodeBase64(string input)
{
return WebEncoders.Base64UrlEncode(System.Text.Encoding.ASCII.GetBytes(input));
}
}
}