Initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace RudderSdk.Core;
|
||||
|
||||
internal static class Url
|
||||
{
|
||||
public static string Encode(string? value) => Uri.EscapeDataString(value ?? string.Empty);
|
||||
|
||||
public static string Query(params (string Key, string? Value)[] values)
|
||||
{
|
||||
var parts = new List<string>();
|
||||
foreach (var item in values)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.Value))
|
||||
parts.Add(Encode(item.Key) + "=" + Encode(item.Value));
|
||||
}
|
||||
|
||||
return parts.Count == 0 ? string.Empty : "?" + string.Join("&", parts);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user