Skip to content

v0.2.1

Latest

Choose a tag to compare

@github-actions github-actions released this 28 Jul 23:34
26313cb

What's in this release

A documentation release. No runtime changes — the only source edits are three TypeScript annotations that are erased at compile time, so the shipped JavaScript is unchanged from v0.2.0 and upgrading cannot alter behaviour.

The reason to read on is that the setup instructions in v0.2.0 were wrong in a way that silently disabled a feature.

Fixed: the documented interceptor order

v0.2.0's README recommended registering the interceptors like this:

withInterceptors([retryInterceptor, apiErrorInterceptor, apiSuccessInterceptor]);

If you copied that, retry has never run in your application. No error, no warning — every request simply gets one attempt.

The first interceptor in the array is the outermost one, so apiErrorInterceptor was nested inside retryInterceptor. By the time a failure reached the retry logic it had already been normalised from an HttpErrorResponse into a plain
ApiError, and retryInterceptor only retries HttpErrorResponses. Nothing ever matched.

The correct order — now documented — is:

withInterceptors([
  apiErrorInterceptor,    // outermost: sees the failure that survived every retry
  apiSuccessInterceptor,
  retryInterceptor,
  bearerTokenInterceptor, // innermost: re-signs every attempt
]);

Measured against a backend returning 503 with maxRetries: 2:

Order HTTP attempts Error handler calls
[retryInterceptor, apiErrorInterceptor] 1 1
[apiErrorInterceptor, retryInterceptor] 3 1

Putting your auth interceptor last matters too: inside the retry loop, each attempt is signed with a fresh token instead of replaying an expired one.

Action required: reorder your withInterceptors([...]) array. There is no code change to pick up — v0.2.0 behaves identically once the order is right.

New: documentation site

Full documentation now lives at https://ismailza.github.io/ngx-api-client/ — getting started, guides for each concern (versioning, error handling, retry, loading state, testing) and a reference for the public API.

Also

  • Internal type annotations tightened; no public API or .d.ts change.
  • READMEs gained badges and links to the documentation site.

Full Changelog: v0.2.0...v0.2.1