/// <summary> /// Formats URL from a template with standard numeric placeholders, ex: {0}. All argument values /// are URL-escaped. The returned URL is full URL, starting with base service address. /// </summary> /// <param name="template">URL template, not including base service part.</param> /// <param name="args">Arguments to insert into the template.</param> /// <returns>Full formatted URL.</returns> public string FormatUrl(string template, params object[] args) { if (string.IsNullOrWhiteSpace(template)) { return(Settings.ServiceUrl); } var url = RestClientHelper.FormatUrl(template, args); string fullUrl; //Check if template is abs URL if (url.StartsWith("http://") || template.StartsWith("https://")) { fullUrl = template; } else { var ch0 = url[0]; var needDelim = ch0 != '/' && ch0 != '?'; var delim = needDelim ? "/" : string.Empty; fullUrl = Settings.ServiceUrl + delim + url; } return(fullUrl); }