public virtual string CreatePathWithQueryStrings()

in src/Elastic.Transport/Requests/RequestParameters.cs [88:113]


	public virtual string CreatePathWithQueryStrings(string? path, ITransportConfiguration? global)
	{
		path ??= string.Empty;
		if (path.Contains("?"))
			throw new ArgumentException($"{nameof(path)} can not contain querystring parameters and needs to be already escaped");

		var g = global.QueryStringParameters;
		var l = QueryString;

		if ((g == null || g.Count == 0) && (l == null || l.Count == 0)) return path;

		//create a copy of the global query string collection if needed.
		var nv = g == null ? new NameValueCollection() : new NameValueCollection(g);

		//set all querystring pairs from local `l` on the querystring collection
		var formatter = global?.UrlFormatter;
		nv.UpdateFromDictionary(l, formatter);

		//if nv has no keys simply return path as provided
		if (!nv.HasKeys()) return path;

		//create string for query string collection where key and value are escaped properly.
		var queryString = nv.ToQueryString();
		path += queryString;
		return path;
	}