angular-interceptors
Useful interceptors for Angular
Installation
npm install angular-interceptors --save
Usage
Cache Interceptor
Cache all HTTP GET
requests.
GET
requests with adisable-cache
header will not be cached.
;
Example:
this.http.get'https://some.url'; // --> https://some.urlthis.http.get'https://some.url'; setTimeout, 5001;
Ensure Https Interceptor
Change http://
to https://
in HTTP request urls.
;
Example:
this.http.get'http://some.url'; // --> https://some.urlthis.http.get'https://some.url'; // --> https://some.url
Prefix Url Interceptor
Prefix HTTP request urls.
;
Example:
this.http.get'/api/user'; // --> https://some.url/api/user
InjectionTokens
The configurations are also available as InjectionToken
s:
InjectionToken | Module |
---|---|
MAX_AGE_MS |
CacheInterceptorModule |
PREFIX |
PrefixUrlInterceptorModule |
;