Skip to content

Found issue when using Credentials #3

@KevinNisbet

Description

@KevinNisbet

Hey,

I was doing a little playing around with you're code, and when using the Network Credentials, it actually looses the credentials when it remakes the RestClient in the TryGetMember Function in RestClient.cs.

To fix this, I added the following:
if (_credentials != null)
operationGroupClient._credentials = _credentials;

The function as a whole:

      public override bool TryGetMember(GetMemberBinder binder, out object result) {
        if (_parameters == null) {
            _parameters = new Dictionary<string, object>();
        }

        object value;
        if (_parameters.TryGetValue(binder.Name, out value)) {
            result = value;
            return true;
        }

        string operationGroup = binder.Name;
        if (_operationGroup != null) {
            operationGroup = _operationGroup + "." + operationGroup;
        }

        RestClient operationGroupClient =
            new RestClient(_uriFormat, _service, operationGroup, _parameters);

        if (_credentials != null)
            operationGroupClient._credentials = _credentials;

        result = operationGroupClient;
        return true;
    }

Just thought I'd contribute back.

Thank You,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions