-
Notifications
You must be signed in to change notification settings - Fork 23
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
fix(stark-core): refactor Http headers related API to prevent undefined and null header values to be added to Angular Http headers #881
Conversation
5ea9acc
to
2c1c826
Compare
if (typeof value !== "undefined") { | ||
public setHeader(name: string, value: string | string[]): this { | ||
// in Angular, a header value can only be string or string[], not null/undefined (https://github.com/angular/angular/issues/18743) | ||
if (typeof value !== "undefined" && value !== null) { |
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.
I understand that we cannot set undefined or null as header value but we don't check the name itself.
What would happen if the name was undefined or null ?
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.
True, I'll fix this
@@ -358,7 +358,12 @@ export class StarkSessionServiceImpl implements StarkSessionService { | |||
this._devAuthenticationHeaders = new Map<string, string>(); | |||
} | |||
|
|||
devAuthenticationHeaders.forEach((value: string, key: string) => this._devAuthenticationHeaders.set(key, value)); | |||
devAuthenticationHeaders.forEach((value: string, key: string) => { |
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.
Should not we change this to (value: string | string[], key: string) => {
?
Because you mention in the comment above that Angular supports both but it is not implemented in this case...
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.
Indeed, I'll fix this
…ion service to prevent undefined and null header values to be added to Angular Http headers. ISSUES CLOSED: #856
2c1c826
to
c728f9c
Compare
ISSUES CLOSED: #856
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #856
What is the new behavior?
The correlationId Http header is not added in case the correlation id is not defined (which is the case when the
loggingFlushDisabled
is true).Does this PR introduce a breaking change?