Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #4236
Closed
Open
Issue created Oct 23, 2019 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[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

Assignee
Assign to
Time tracking