Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default headers configuration. #211

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlejandroJadzinsky
Copy link

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.

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.
@@ -18,6 +18,8 @@
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 : {};
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use const instead of let since you never change this variable.

Copy link
Author

Choose a reason for hiding this comment

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

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.

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.

None yet

2 participants