Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated Proxies Should Create Constructors Accepting Strings/Uris #24

Closed
Mike-E-angelo opened this issue Nov 1, 2014 · 3 comments
Closed

Comments

@Mike-E-angelo
Copy link

Hello,

I just noticed that generated clients depend on a hard-coded string that also gets generated. This does not account for environment-specific use cases where the URL of the service will change based on the environment. The generated proxies should create constructors that accept both strings and URIs so that the base address can be assigned via configuration based on the target environment. I will definitely be providing a PR for this. :)

Thank you,
Michael

@faniereynders
Copy link
Member

That's a great idea @Michael-DST!

In the meanwhile, here is a workaround for the C# client. You have access to the normal ASP.NET WebApi Client, just simply set the BaseAddress here:

using (var client = new PeopleClient())
{
   client.HttpClient.BaseAddress = new Uri("http://dev.some-other-url.com");
   var response = await client.GetAsync();
   response.EnsureSuccessStatusCode();
   var content = await response.Content.ReadAsAsync<object>();
}

@wolfen351
Copy link
Collaborator

This should be quite easy to add, any chance of a pull request?

@faniereynders
Copy link
Member

Merged with #49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants