Simplify headers handling#295
Merged
meili-bors[bot] merged 3 commits intomainfrom Jan 27, 2022
Merged
Conversation
This improvement creates a new attr to be instantiated during the initializer and after the instantiation it could not be updated directly, just copies of it. The general idea was to remove some helper methods `clone_options` and `merge_options` that only had a purpouse because we have been handling the headers inside a hash (options hash). This extra complexity makes the requirement to have all these internal structures in order to be possible to add/remove and modify the items inside of it. After this we should only update a clone when it's required like was did in the lines 30, 41, 72.
* Avoid parameter lists longer than 5 parameters. [6/5]
brunoocasali
commented
Jan 26, 2022
| def build_default_options_headers | ||
| { | ||
| 'Content-Type' => 'application/json', | ||
| 'Authorization' => ("Bearer #{@api_key}" unless @api_key.nil?) |
Member
Author
There was a problem hiding this comment.
That I was trying to show to you @curquiza that day #273 comment 😅
Member
Author
|
bors merge |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This improvement creates a new attr to be instantiated during the initializer phase and after the instantiation, it could not be updated directly, just copies of it using
dup.This should simplify the headers handling since they were mixed with options.
Originally extracted from #292