示例#1
0
        public string ResolveParamsUrl(ParamsUrl paramsUrl)
        {
            StringBuilder sb    = new StringBuilder(paramsUrl.Url);
            bool          added = false;

            foreach (KeyValuePair <string, object> keyValuePair in paramsUrl)
            {
                if (!added)
                {
                    sb.Append("?");
                    added = true;
                }
                else
                {
                    sb.Append("&");
                }

                //转换变量名
                string propertyName = _config.ParamUrlPropertyNameCase.Case(keyValuePair.Key);
                sb.Append(propertyName).Append("=").Append(keyValuePair.Value);
            }

            return(sb.ToString());
        }
示例#2
0
 public RestRequest this[ParamsUrl url, HttpContent content, Action <HttpRequestHeaders> headersAction = null]
 => this[ResolveParamsUrl(url), content, headersAction];