I am using UriTemplate (System.ServiceModel) to bind a template to an object and create a url
var baseUri = new Uri("http://example.com");
var template = new UriTemplate("");
var properties = new NameValueCollection
{
{"a", "1"},
{"a", "2"},
{"a", "3"}
};
Assert.Equal(
new Uri(baseUri, "?a=1&a=2&a=3"),
template.BindByName(baseUri, properties));
=>
Expected: http://example.com/?a=1&a=2&a=3
Actual: http://example.com/?a=1%2c2%2c3
The expected result will work for a webapi endpoint, but the actual does not as the convention of comma separating a parameter is not official and not supported by web api
Is there a way I can get the expected result?
I do need to use url templating for binding values (e.g. {one}/two/{three}
), though not necessarily UriTemplate from System.ServiceModel - what does WebApi use? is it exposed?