Forum Discussion

Pitex's avatar
3 years ago

Changing the base path for generated C# client

Hi, I've been trying to set up a local dev environment and wanted to change the Swagger Codegen generated C# API so that it sends request to locally running service.


Maybe I'm just missing something, but I did the following:

api = new DefaultApi(

  new Configuration {

    Timeout = 15000,

    BasePath = "http://localhost:8891/<my_api_path>"



But the requests still get sent to "https://<remote_host>/<my_api_path>" (which is the default value of BasePath based on OpenAPI doc).


I've tried checking whether it's correctly set at runtime, but api.Configuration.BasePath and api.Configuration.ApiClient.RestClient.BaseUrl seem to be correctly set to "http://localhost:8891/<my_api_path>".


Am I missing some part of configuration, or is it a bug?

I'm using Swagger Codegen v2.4.25 and OpenApi v2

No RepliesBe the first to reply