Add default headers configuration.#211
Open
AlejandroJadzinsky wants to merge 1 commit intowcandillon:masterfrom
Open
Add default headers configuration.#211AlejandroJadzinsky wants to merge 1 commit intowcandillon:masterfrom
AlejandroJadzinsky wants to merge 1 commit intowcandillon:masterfrom
Conversation
In general, all the endpoints in an API shear the same headers, and these headers are not really part of the domain contract and are used for protocol or context usages, so define them as header parameters is cumbersome, on the contrary, define them at configuration time feels great.
ChrisJamesC
reviewed
Feb 26, 2018
| if(this.domain.length === 0) { | ||
| throw new Error('Domain parameter must be specified as a string.'); | ||
| } | ||
| {{#isES6}}let{{/isES6}}{{^isES6}}var{{/isES6}} headers = (typeof options === 'object') ? options.headers : {}; |
Contributor
There was a problem hiding this comment.
You can use const instead of let since you never change this variable.
Author
There was a problem hiding this comment.
You are technically right, but I decided to follow the same coding style used to define the domain attribute (line 16) in order introduce as fewer changes as possible and to establish a pattern that could be easily refactored in the future.
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.
In general, all the endpoints in an API shear the same headers,
and these headers are not really part of the domain contract and
are used for protocol or context usages, so define them as header
parameters is cumbersome, on the contrary, define them at
configuration time feels great.