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

How to set up proxy? #24

Closed
NagashreeHS opened this issue May 7, 2020 · 1 comment
Closed

How to set up proxy? #24

NagashreeHS opened this issue May 7, 2020 · 1 comment

Comments

@NagashreeHS
Copy link

We are using below code to connect. But we are not sure where to add proxy settings. Can you please help ?

        public void Initialise(HttpMessageHandler messageHandler = null, HttpClient httpClient = 
        null)
        {
        var username = _faxConfiguration.UserName;
        var password = _faxConfiguration.Password;
        if (string.IsNullOrEmpty(username))
            throw new ArgumentException($"{username} has not been set.");

        if (string.IsNullOrEmpty(password))
            throw new ArgumentException($"{password} has not been set.");

        Account = new Account(this);
        Inbound = new Inbound(this);
        Outbound = new Outbound(this);
        Documents = new Documents(this);

        HttpClient = messageHandler == null ? new HttpClient() : new HttpClient(messageHandler);
        HttpClient = httpClient ?? HttpClient;

        HttpClient.BaseAddress = new Uri($"https://rest.interfax.net/");
        HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        HttpClient.DefaultRequestHeaders.Add("Authorization",
            new List<string> { $"Basic {Utils.Base64Encode($"{username}:{password}")}" });

        JsonConvert.DefaultSettings = () =>
        {
            var settings = new JsonSerializerSettings();
            settings.Converters.Add(new StringEnumConverter { CamelCaseText = true });
            return settings;
        };
    }
@ricky-shake-n-bake-bobby
Copy link
Contributor

The code above does not relate to this client/package. For developer support, please reach out to dev@interfax.net

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

No branches or pull requests

2 participants