Skip to content

Making HttpClient static again when not using in tests#526

Merged
eddynaka merged 2 commits into
mainfrom
users/ednakamu/making-httpclient-static-again
Aug 6, 2021
Merged

Making HttpClient static again when not using in tests#526
eddynaka merged 2 commits into
mainfrom
users/ednakamu/making-httpclient-static-again

Conversation

@eddynaka

@eddynaka eddynaka commented Aug 5, 2021

Copy link
Copy Markdown
Collaborator

@michaelcfanning , this is the change we talked yesterday at night.
We will have two httpclients, one that is static and one private.
The static will be normally used.
The private will only be used during tests.

if (httpClient == null)
// The httpClient is the property that will be used for tests only.
if (httpClient != null)
{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we be using this. as a prefix here? to make it clear we're referencing instance data on the class?

i like this pattern, or we could use m_ as a prefix to make that distinction clear. what do we do elsewhere?

@@ -324,24 +327,30 @@ internal void SetHttpClient(HttpClient client)

protected HttpClient CreateOrUseCachedHttpClient()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreateOrUseCachedHttpClient

Change this name to CreateOrRetrieveCachedHttpClient

@michaelcfanning michaelcfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@eddynaka eddynaka enabled auto-merge (squash) August 6, 2021 10:46
@eddynaka eddynaka merged commit 640f7f6 into main Aug 6, 2021
@eddynaka eddynaka deleted the users/ednakamu/making-httpclient-static-again branch August 6, 2021 10:53
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.

2 participants