Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #42: Added support for a custom HttpMessageHandler #74

Closed
wants to merge 1 commit into from

Conversation

ElasticCoder
Copy link

@ElasticCoder ElasticCoder commented Mar 11, 2019

This PR allows the consumer to specify a custom HttpMessageHandler.

This may be to:

  1. override SSL verification and support connecting to the emulator from a Linux machine across the network, for example when connecting from within a Linux container
  2. specifying an HTTP proxy if one is needed to connect to the Internet

A new constructor has been added to DocumentClient which has the same signature as the V2 SDK - it allows the consumer to inject an HttpMessageHandler which is then wired up to the InnerHandler of the HttpRequestMessageHandler.

The CosmosClientBuilder has a UseHttpMessageHandler method addded to it which allows the consumers to add the handler.

var handler = new HttpClientHandler();
handler.ServerCertificateCustomValidationCallback += (message, certificate2, x509Chain, sslPolicyErrors) => true;

using (var client = new CosmosClientBuilder(accountEndpoint, accountKey)
                    .UseConnectionModeGateway()
                    .UseHttpMessageHandler(handler)
                    .Build())
{
    // My code goes here
}

@ElasticCoder
Copy link
Author

@kirankumarkolli I can't seem to add you as a reviewer, but please can you review this change also?

@ealsur
Copy link
Member

ealsur commented May 23, 2019

@ElasticCoder We are going to move ahead with this (sorry for the delay), could you merge master into your fork? We can then proceed to verify and merge this

@ElasticCoder
Copy link
Author

Hi, I've gone to look at this today, but it looks like the changes have been added to the master?
#136

@ausfeldt
Copy link
Contributor

test

@ausfeldt
Copy link
Contributor

/AzurePipelines run

@azure-pipelines
Copy link

Pull request contains merge conflicts.

@j82w
Copy link
Contributor

j82w commented Aug 28, 2019

@ElasticCoder we finally got around to prioritizing, and decided to go with a simpler user experience in v3. Check out this PR.

@j82w j82w closed this Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants