예제 #1
0
        static string FormatBody(RequestType type, PropertyList parameters)
        {
            string body = string.Empty;

            if (parameters != null)
            {
                switch (type)
                {
                case RequestType.FormUrlEncoded:
                {
                    HttpUrlBuilder builder = new HttpUrlBuilder();
                    foreach (var item in parameters)
                    {
                        builder.Add(item.Key, item.Value);
                    }
                    body = builder.ToString();
                }
                break;

                default:
                    body = parameters.FirstOrDefault()?.Value ?? string.Empty;
                    break;
                }
            }

            return(body);
        }