Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

feat: reuse http.Client #248

Merged
merged 4 commits into from
Feb 23, 2021
Merged

feat: reuse http.Client #248

merged 4 commits into from
Feb 23, 2021

Conversation

jawnsy
Copy link
Contributor

@jawnsy jawnsy commented Feb 19, 2021

  • Create Client interface, so that it can be mocked/stubbed
  • Validate client options at creation time
  • Reuse internal HTTP Client, so that we have connection pooling
  • Send the Session-Token in a header rather than cookie

* Create Client interface, so that it can be mocked/stubbed
* Validate client options at creation time
* Reuse internal HTTP Client, so that we have connection pooling
* Send the Session-Token in a header rather than cookie
@jawnsy jawnsy requested review from tychoish and cmoog February 19, 2021 19:51
@jawnsy jawnsy self-assigned this Feb 19, 2021
@shortcut-integration
Copy link

This pull request has been linked to Clubhouse Story #7910: Refactor coder-sdk to reuse http.Client.

Copy link

@tychoish tychoish left a comment

Choose a reason for hiding this comment

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

love it.

@jawnsy jawnsy requested a review from deansheather February 22, 2021 18:23
@jawnsy jawnsy marked this pull request as ready for review February 23, 2021 02:05
Copy link
Contributor

@cmoog cmoog left a comment

Choose a reason for hiding this comment

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

I could go either way on this one, so your call. One additional data point for consideration, take a look at how AWS does it with a separate package for the interface definitions https://github.com/aws/aws-sdk-go/blob/master/service/ec2/ec2iface/interface.go.
Not saying this is particularly clean, just another option.

@jawnsy jawnsy changed the title feat: create and implement Client interface feat: reuse http.Client and validate client options at creation time Feb 23, 2021
@jawnsy jawnsy merged commit 64be2fb into master Feb 23, 2021
@jawnsy jawnsy deleted the jawnsy/ch7910/reuse-httpclient branch February 23, 2021 17:18
@jawnsy jawnsy changed the title feat: reuse http.Client and validate client options at creation time feat: reuse http.Client Feb 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants