feat: persist the HTTP client inside of EasyPostClient #322
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
We previously recreated the Guzzle Client on every request. This PR moves the creation of the HTTP client into the
EasyPostClient
object to ensure that back-to-back requests using the same EasyPostClient will reuse the same HTTP client to reduce memory consumption. There should be no user impact with this change.Please note that although the HTTP client is now a publicly accessible property of the EasyPostClient, it is not intended to be replaced as no additional work has been made yet to allow this (see #318 for that initiative)
Closes #315
Testing
Re-recorded a cassette with two requests to ensure it works as expected
Pull Request Type
Please select the option(s) that are relevant to this PR.