@experteam-mx/ngx-services
Version:
Angular common services for Experteam apps
13 lines (12 loc) • 756 B
TypeScript
import { HttpEvent, HttpHandlerFn, HttpRequest } from '@angular/common/http';
import { Observable } from 'rxjs';
/**
* Interceptor function to handle HTTP caching for GET requests. It retrieves cached responses
* if available and valid; otherwise, it processes the request and caches the response for future use.
*
* @param {HttpRequest<any>} req - The HTTP request object being intercepted.
* @param {HttpHandlerFn} next - The next HTTP handler function in the chain to process the request.
* @return {Observable<HttpEvent<any>>} An observable that emits the HTTP event, either from cache
* or by invoking the next handler.
*/
export declare function httpCachingInterceptor(req: HttpRequest<any>, next: HttpHandlerFn): Observable<HttpEvent<any>>;