Here is what is the issue. I'm using portable RestSharp which uses HttpClient under the hood. But for iOS there is problem with HttpClient, because the Default IWebProxy instance doesn't allow to monitor requests using request monitoring software like Charles (look here to see the issue and the solution )
The solution for this is using CFNetwork.GetDefaultProxy ()
which returns IWebProxy
and set it as proxy of a request. I tried setting the Proxy property of RestClient
but it didn't work, when digging in the open source code of portable RestClient
I found out that the Proxy property is not used anywhere. The only place where it is used is commented out. That method is called ConfigureProxy
line 572 in RestSharp.Portable
project RestClient
file, and this method is called only from ConfigureHttp
method line 541 same file, which is also commented out. I believe this is a bug. May be someone has forgotten to set Proxy after commenting out this code. So can someone tell me wether it will be safe to remove the commented line, or may be say the right place where to set the proxy of IHttp interface? For instance is it safe to set the proxy on the line 393 (this is again in the RestClient file) of the attached image, like
httpRequest.Proxy = this.Proxy;
strong text