watson-developer-cloud / dotnet-standard-sdk

:new::new::new:.NET Standard library to access Watson Services.
https://www.nuget.org/profiles/ibm-watson
Apache License 2.0
147 stars 117 forks source link

Support for web request proxy #452

Closed darkmatter2222 closed 3 years ago

darkmatter2222 commented 3 years ago

Super Simple,

We are using this SDK behind a corporate proxy. This SDK does not enable the developer to set the proxy prior to the web request is made to IBM Cloud. Prime example: https://github.com/watson-developer-cloud/dotnet-standard-sdk/blob/1af67675044bda3b1647ba4e4bea9f5104fce923/src/IBM.Watson.Discovery.v2/DiscoveryService.cs#L103

Solutions like the one outlined here are extremely primitive:

Please allow a proxy to be set at the class level to be used on each request to IBM cloud.

I would suggest this feature be implemented for all classes here. We came across this as part of IBM.Watson.Discovery.v2

How to set a proxy: https://docs.microsoft.com/en-us/dotnet/api/system.net.webrequest.proxy?view=net-5.0

kevinkowa commented 3 years ago

I'll look into this soon, thank you for bringing up this issue!

darkmatter2222 commented 3 years ago

@kevinkowa, are you accepting contributions?

mediumTaj commented 3 years ago

Yes please feel free to submit a PR!

darkmatter2222 commented 3 years ago

@mediumTaj, @kevinkowa, the right place to make this adjustment would be in the constructor of the client by feeding in proxy as a HttpClientHandler. This appears to be done in IBM.Cloud.SDK.Core. Can you point me into the direction of that source. Having trouble finding it.

Outlined here

mediumTaj commented 3 years ago

https://github.com/IBM/dotnet-sdk-core

kevinkowa commented 3 years ago

@darkmatter2222 Thank you for contributing!