Skip to content

test(http): disable XSRF and mock location in HttpClient tests to avoid Domino failures and state leakage#68021

Open
dgp1130 wants to merge 1 commit intoangular:mainfrom
dgp1130:fix-http-flakes
Open

test(http): disable XSRF and mock location in HttpClient tests to avoid Domino failures and state leakage#68021
dgp1130 wants to merge 1 commit intoangular:mainfrom
dgp1130:fix-http-flakes

Conversation

@dgp1130
Copy link
Copy Markdown
Contributor

@dgp1130 dgp1130 commented Apr 3, 2026

The HttpClient tests in client_spec.ts were failing intermittently in Node/Domino environment because MockPlatformLocation defaults to http://_empty_/. This valid URL satisfied the URL parser in xsrfInterceptorFn, causing it to proceed to cookie extraction which throws NotYetImplemented in Domino.

To fix this:

  1. Disabled XSRF protection in client_spec.ts using withNoXsrfProtection(), as these tests are not for XSRF.
  2. Provided MockPlatformLocation with an explicit startUrl: 'http://localhost/' to remove state leakage effects and ensure consistency.

…id Domino failures and state leakage

The `HttpClient` tests in `client_spec.ts` were failing intermittently in Node/Domino environment because `MockPlatformLocation` defaults to `http://_empty_/`. This valid URL satisfied the URL parser in `xsrfInterceptorFn`, causing it to proceed to cookie extraction which throws `NotYetImplemented` in Domino.

To fix this:
1. Disabled XSRF protection in `client_spec.ts` using `withNoXsrfProtection()`, as these tests are not for XSRF.
2. Provided `MockPlatformLocation` with a explicit `startUrl: 'http://localhost/'` to remove state leakage effects and ensure consistency.
@dgp1130 dgp1130 added action: review The PR is still awaiting reviews from at least one requested reviewer area: common/http Issues related to HTTP and HTTP Client target: patch This PR is targeted for the next patch release labels Apr 3, 2026
@ngbot ngbot bot added this to the Backlog milestone Apr 3, 2026
@pullapprove pullapprove bot requested review from AndrewKushnir April 3, 2026 18:59
@AndrewKushnir AndrewKushnir requested a review from atscott April 3, 2026 23:17
Comment on lines +26 to +29
{
provide: PlatformLocation,
useFactory: () => new MockPlatformLocation({startUrl: 'http://localhost/'}),
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IIRC the default platform location is the one that is compatible with the Navigation API. I believe just providing MOCK_PLATFORM_LOCATION_CONFIG instead should work and keep Navigation working. Not that http client tests need Navigation, but probably safest to keep as a "good example" that retains the most complete set of mocks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: common/http Issues related to HTTP and HTTP Client target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants