Skip to content

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.
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.

2 participants