Skip to content

client-angular ignores AbortSignal #4303

Description

@gritsev

Description

@hey-api/client-angular accepts signal through its request options because the client configuration extends RequestInit, but the signal is not connected to the HttpClient observable. As a result, aborting the signal does not cancel an in-flight Angular HTTP request, and an already-aborted signal still starts one.

This differs from the fetch client and makes generated Angular SDK requests impossible to cancel through the shared client API.

I intend to submit a pull request to fix this.

Expected behavior

  • An already-aborted signal prevents HttpClient.request() from starting.
  • Aborting an in-flight request unsubscribes from the HttpClient observable, allowing Angular to abort the underlying transport.
  • The abort reason follows the existing error interceptor and throwOnError behavior.
  • Requests without a signal and requests completed before a later abort remain unchanged.

Actual behavior

The Angular client awaits the filtered HttpClient observable with firstValueFrom(), but never observes options.signal.

Reproducible example or configuration

const controller = new AbortController();

const request = client.get({
  signal: controller.signal,
  throwOnError: true,
  url: '/slow-request',
});

controller.abort();
await request;

The underlying Angular HTTP request remains subscribed instead of being cancelled.

System information

  • @hey-api/openapi-ts: current main (0.99.0)
  • @hey-api/client-angular
  • Angular 21.2.x
  • RxJS 7.8.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions