-
Notifications
You must be signed in to change notification settings - Fork 8
[STREAM-63] - Add custom headers to all API requests if they're passed into config. #299
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
Conversation
@@ -75,7 +75,7 @@ export class Client extends EventEmitter { | |||
|
|||
constructor (options: IClientOptions) { | |||
super(); | |||
this.http = new HttpClient(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When Streaming Client spins up a HttpClient
instance, it now passes in the customHeaders from the config (though perhaps we should check if it exists first?) so that the HttpClient
can then use it at a later point
opts.customHeaders = { | ||
...this.customHeaders, | ||
...opts.customHeaders | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thinking here (which Jon and I worked through) is that though we can't think of a reason why this would be the case, but if there is a scenario where we need to pass in a different value for customHeaders
than what is passed in for the Streaming Client config, then we should use that passed in value over the config value which is hopefully what will happen here. Again, we can't think of a reason this would happen, but if someone passes in a different customHeaders
, there would be a reason behind it so it needs to be honored.
…f customHeaders, added in HttpClientOptions to hopefully reduce the need of breaking changes in the future
@@ -671,8 +670,7 @@ export class Client extends EventEmitter { | |||
method: 'post', | |||
host: this.config.apiHost, | |||
authToken: this.config.authToken, | |||
logger: this.logger, | |||
customHeaders: this.config.customHeaders |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed these because they get added in regardless in requestApi
, so it seemed a bit redundant for the same customHeaders
Can we change the PR title? I'm not sure it makes sense. We're not checking for custom headers, we're just passing them along. |
No description provided.