Amido.Testing.Http.RestClient.AddQueryStringParameter C# (CSharp) Method

AddQueryStringParameter() public method

Adds a query string parameter to the request url.
public AddQueryStringParameter ( string key, string value ) : IRestClient
key string The key of the querystring parameter.
value string The value of the querystring parameter.
return IRestClient
        public virtual IRestClient AddQueryStringParameter(string key, string value)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(key), "The key cannot be null or empty.");
            Contract.Requires(!string.IsNullOrWhiteSpace(value), "The value cannot be null or empty.");

            var querySeparator = "?";
            if (url.IndexOf("?", StringComparison.InvariantCulture) > -1)
            {
                querySeparator = "&";
            }

            url = string.Format("{0}{1}{2}={3}", url, querySeparator, key, value);

            return this;
        }