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

Make httpClient field protected or public #91

Open
montoner0 opened this issue Mar 26, 2024 · 1 comment
Open

Make httpClient field protected or public #91

montoner0 opened this issue Mar 26, 2024 · 1 comment

Comments

@montoner0
Copy link

Is your feature request related to a problem? Please describe.

Since httpClient is currently an internal field it makes unit testing and expanding the Client class significantly harder and involves vague techniques (e. g. to make possible HttpClient substitution with a mocked one I've changed RootNamespace property of my test project to Conjur).

Describe the solution you would like

Make httpClient field either protected, public or assignable from outside in some other way (e.g. parameter of constructor).

Additional context

Mocking HttpClient is essential in unit testing since we need predictable responses. In expanding of the Client class, accessing to an HttpClient instance also plays major role.

@montoner0
Copy link
Author

Another obstacle on the path of a happy unit-testing is ApiKeyAuthenticator.GetToken() method which creates its own HttpClient instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant