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()); }
public RestRequest this[ParamsUrl url, HttpContent content, Action <HttpRequestHeaders> headersAction = null] => this[ResolveParamsUrl(url), content, headersAction];