Skip to content

[Test] RequestsCanBeInterceptedAndHeadersAddedForDifferentHosts is flaky on CoreCLR MacCatalyst due to external service dependency #33927

@rmarinho

Description

@rmarinho

Description

The BlazorWebView device test RequestsCanBeInterceptedAndHeadersAddedForDifferentHosts(uriBase: "app://echoservice/") is flaky on CoreCLR MacCatalyst. It depends on an external echo service (https://echo.free.beeceptor.com/sample-request) which makes it unreliable in CI.

Failure Details

Root Cause

The iOS/MacCatalyst code path in this test (BlazorWebViewTests.RequestInterception.cs:178-229):

  1. Intercepts the app://echoservice/ fetch request
  2. Creates a copy of the NSUrlRequest and changes the URL to https://echo.free.beeceptor.com/sample-request (an external third-party service)
  3. Adds a custom X-Request-Header
  4. Sends the modified request via NSUrlSession
  5. The echo service is expected to reflect headers back in the JSON response body

The test fails when the external service does not respond as expected (network issues, service downtime, rate limiting).

In the failing build, the same test passed on Mono MacCatalyst (13/13) but failed on CoreCLR MacCatalyst (12/13), suggesting either network flakiness across machines or a possible CoreCLR-specific interop difference with NSUrlSession.

Suggested Fix

Replace the external echo.free.beeceptor.com dependency with a local/self-hosted echo mechanism to make the test deterministic. The test should verify header interception without relying on third-party services.

Additional context

The following tests in the same file also depend on the same external echo service and may be similarly affected:

  • RequestsCanBeInterceptedAndCustomDataReturnedForDifferentHosts
  • RequestsCanBeInterceptedAndCancelledForDifferentHosts
  • RequestsCanBeInterceptedAndCaseInsensitiveHeadersRead

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorBlazor Hybrid / Desktop, BlazorWebViews/triagedIssue has been reviewed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions