[BUG] [csharp-netcore] No way to pass proxy
Created by: PeterTriebe
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
What's the version of OpenAPI Generator used? -
Have you search for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Bounty to sponsor the fix (example)
Description
Sorry I'm not shure if this a bug or feature request.
My client is generated with csharp-netcore. I want to setup a proxy with the generated client. Here is mandatory not changig the generated code.
But there is actually no way to pass a proxy to the RestSharp client. Everything is wrapped.
In Net framwork and Net core 3 its possible to setup a global proxy. But in Net core 2 its not possible.
Before using csharp-netcore i generated the client the client under targetframework net45. Here i was able to use a proxy.
Example:
var proxy = new WebProxy("http://localhost:3128")
{
Credentials = new NetworkCredential("USER", "PASS")
};
var config = new Configuration
{
BasePath = "https://my-example-api.com/api/v1",
AccessToken = token.access_token
};
config.ApiClient.RestClient.Proxy = proxy;
In the same way its missed for netstandard.
openapi-generator version
4.1.3
OpenAPI declaration file content or url
Command line used for generation
java -jar "openapi-generator-cli-4.1.3.jar" generate -i api.yaml -g csharp-netcore -o Example.Client -p packageName=Example.Client
Steps to reproduce
Generate a csharp-netcore client and try to setup a proxy
Related issues/PRs
Suggest a fix
I think its needed to add api client configuration to the config in the same way like in Net framework