Repository navigation
refactor(@angular/ssr): reuse ɵisHostAllowed from @angular/platform-server - #34793
Open
alan-agius4 wants to merge 1 commit into
Open
alan-agius4 wants to merge 1 commit into
alan-agius4 wants to merge 1 commit into
Conversation
…erver Replace the duplicate local `isHostAllowed` implementation in `@angular/ssr` with `ɵisHostAllowed` from `@angular/platform-server` so host allowlist matching stays consistent across both packages. Extract the framework-independent HTTP/proxy header helpers into `src/utils/headers.ts` so `node/src/request.ts` and its pure-Node unit tests do not pull in `@angular/platform-server`.
There was a problem hiding this comment.
Code Review
This pull request refactors the codebase by moving header-related utility functions from packages/angular/ssr/src/utils/validation.ts to a new file packages/angular/ssr/src/utils/headers.ts to improve modularity. The reviewer identified a potential bug in the getFirstHeaderValue function where passing an empty array results in an empty string instead of undefined, which could cause issues with downstream nullish coalescing. A code suggestion was provided to handle array inputs explicitly and improve the function's robustness.
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.
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
@angular/ssrmaintains a duplicateisHostAllowedimplementation inpackages/angular/ssr/src/utils/validation.tsinstead of reusingɵisHostAllowedexported by@angular/platform-server, risking drift with changes in@angular/platform-server(such as angular/angular#72203).What is the new behavior?
isHostAllowedimplementation inpackages/angular/ssr/src/utils/validation.tswithɵisHostAllowedfrom@angular/platform-server.packages/angular/ssr/src/utils/headers.tssopackages/angular/ssr/node/src/request.tsand pure-Node tests do not pull in@angular/platform-server.Does this PR introduce a breaking change?
Other information
server.mjsbundle output:@angular/core, Domino,xhr2, andrxjsremain completely tree-shaken out in production builds.validateUrlandverifyHostAllowed.