roadie/RoadieApi/Services/HttpEncoder.cs

39 lines
899 B
C#
Raw Normal View History

2018-11-11 01:11:58 +00:00
using Microsoft.AspNetCore.WebUtilities;
using Roadie.Library.Encoding;
2018-11-03 21:21:36 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
namespace Roadie.Api.Services
{
public class HttpEncoder : IHttpEncoder
{
2018-11-04 15:16:52 +00:00
public string HtmlEncode(string s)
{
return HttpUtility.HtmlEncode(s);
}
2018-11-03 21:21:36 +00:00
public string UrlDecode(string s)
{
return HttpUtility.UrlDecode(s);
}
public string UrlEncode(string s)
{
return HttpUtility.UrlEncode(s);
}
2018-11-11 01:11:58 +00:00
public string UrlEncodeBase64(byte[] input)
{
return WebEncoders.Base64UrlEncode(input);
}
public string UrlEncodeBase64(string input)
{
return WebEncoders.Base64UrlEncode(System.Text.Encoding.ASCII.GetBytes(input));
}
2018-11-03 21:21:36 +00:00
}
}