@experteam-mx/ngx-services 20.0.0-beta.3 → 20.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4386,6 +4386,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
4386
4386
|
args: ['env']
|
|
4387
4387
|
}] }] });
|
|
4388
4388
|
|
|
4389
|
+
function isStaticAsset$1(url) {
|
|
4390
|
+
return url.startsWith('assets/') || url.includes('/i18n/');
|
|
4391
|
+
}
|
|
4389
4392
|
/**
|
|
4390
4393
|
* Intercepts an outgoing HTTP request and modifies its headers to include default values
|
|
4391
4394
|
* for Cache-Control, Expires, Pragma, Content-Type, Accept, and Accept-Language if they
|
|
@@ -4396,7 +4399,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
4396
4399
|
* @return {Observable<HttpEvent<unknown>>} An observable of the HTTP event resulting from the processed request.
|
|
4397
4400
|
*/
|
|
4398
4401
|
function apiHeadersInterceptor(req, next) {
|
|
4399
|
-
|
|
4402
|
+
if (isStaticAsset$1(req.url)) {
|
|
4403
|
+
return next(req);
|
|
4404
|
+
}
|
|
4405
|
+
let headers = req.headers;
|
|
4406
|
+
const noCacheHeaders = {
|
|
4407
|
+
'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0',
|
|
4408
|
+
Pragma: 'no-cache',
|
|
4409
|
+
Expires: '0',
|
|
4410
|
+
};
|
|
4411
|
+
Object.entries(noCacheHeaders).forEach(([key, value]) => {
|
|
4412
|
+
if (!headers.has(key)) {
|
|
4413
|
+
headers = headers.set(key, value);
|
|
4414
|
+
}
|
|
4415
|
+
});
|
|
4400
4416
|
if (!headers.has('Content-Type') && !(req.body instanceof FormData)) {
|
|
4401
4417
|
headers = headers.set('Content-Type', 'application/json');
|
|
4402
4418
|
}
|
|
@@ -4410,6 +4426,7 @@ function apiHeadersInterceptor(req, next) {
|
|
|
4410
4426
|
return next(req);
|
|
4411
4427
|
}
|
|
4412
4428
|
|
|
4429
|
+
const isStaticAsset = (url) => url.startsWith('assets/') || url.includes('/i18n/');
|
|
4413
4430
|
/**
|
|
4414
4431
|
* HTTP interceptor that injects the external operations API key into outbound requests.
|
|
4415
4432
|
*
|
|
@@ -4443,6 +4460,9 @@ function apiHeadersInterceptor(req, next) {
|
|
|
4443
4460
|
* @see HttpHandlerFn
|
|
4444
4461
|
*/
|
|
4445
4462
|
function apiKeyInterceptor(request, next) {
|
|
4463
|
+
if (isStaticAsset(request.url)) {
|
|
4464
|
+
return next(request);
|
|
4465
|
+
}
|
|
4446
4466
|
const { apiExternalOperationsKey } = inject(ENVIRONMENT_TOKEN);
|
|
4447
4467
|
if (!apiExternalOperationsKey)
|
|
4448
4468
|
return next(request);
|