Ignore case on URI matching

Topics: Web Api
Nov 2, 2011 at 8:47 PM

Is there anyway that

[WebGet(UriTemplate = "/trigger({id})")]

public ResultObject Trigger(string id, HttpRequestMessage message)

could match a call http://myserver.com/trigger(12345) and http://myserver.com/Trigger(12345) ?

 

Or is there a simple config I am missing somewhere?

 

Thanks

Jeff

Nov 4, 2011 at 11:43 PM
Edited Nov 4, 2011 at 11:56 PM

Hi Jeff,

Path segments are case sensitive in UriTemplate. Here is the relevant part from MSDN (http://msdn.microsoft.com/en-us/library/bb675245.aspx):

"When comparing template strings for structural equivalence, case is ignored for variable names and path segments, query strings are case sensitive."

Maybe you can look into overriding the OnSelectOperation method in UriAndMethodOperationSelector (which is the default HttpOperationSelector) to ignore the casing when selecting the operation.

Thanks,

Yao