You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which @angular/* package(s) are relevant/related to the feature request?
common
Description
With the release of httpResource, it would be great for the interceptor function to accept a promise so that RxJs dependency can be removed here as well. Currently, it only accepts an observable.
Proposed solution
export function interceptor(request: HttpRequest<unknown>, next: HttpHandlerFn): Promise<HttpEvent<unknown>> {
// before api logic
return next(request).then(result => {
// tap logic
}).catch((requestError: HttpErrorResponse) => {
// error logic
});
}
Instead of
export function interceptor(request: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>> {
// before api logic
return next(request).pipe(
tap(result => {
// tap logic
}),
catchError((requestError: HttpErrorResponse) => {
// error logic
return throwError(() => requestError);
})
);
}
The text was updated successfully, but these errors were encountered:
coder-ashwin
changed the title
interceptor as promise
Feature Request: interceptor as promise
May 17, 2025
coder-ashwin
changed the title
Feature Request: interceptor as promise
Feature Request: interceptor to accept promise
May 17, 2025
Which @angular/* package(s) are relevant/related to the feature request?
common
Description
With the release of httpResource, it would be great for the interceptor function to accept a promise so that RxJs dependency can be removed here as well. Currently, it only accepts an observable.
Proposed solution
Instead of
The text was updated successfully, but these errors were encountered: