Closed gregmulvihill closed 8 years ago
Hi @gregmulvihill, thanks for your contribution!
What will happen if there are also a trailing slashes in the configuration? Should it matter, because we don't want something resolving to http://myapi/mydir//
It's maybe wise to unify these slashes somehow.
@faniereynders, good point. OK, I retract my previous suggestion and offer this instead.
In WebApiProxy\WebApiProxy.Server\MetadataProvider.cs, change line 83 to this: Host = System.Web.VirtualPathUtility.AppendTrailingSlash(host);
I will create a pull request.
I discovered that calls to HttpClient.GetAsync in the WebApiProxy.generated.cs file were returning a 404 after I added an additional directory to my Web API path, eg, http://localhost/AdditionalDirectory/api/Values. I was able to use the API (with the additional directory) from a web browser. When I examined the request Uri, it was http://localhost/api/Values, rather than http://localhost/AdditionalDirectory/api/Values. I verified MyWebApiProxyBaseAddress was set correctly. In my effort to figure out what was going on, I cam across this SO question/answer, http://stackoverflow.com/a/23438417/640326. I manually added a slash to the end of MyWebApiProxyBaseAddress, and everything worked as expected. It looks like adding a slash just before the last quote in CSharpProxyTemplate.tt, line 38 should work?