Skip to content

Commit e0fb391

Browse files
committed
Fix header value check
1 parent cee164d commit e0fb391

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/html/CSS.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ class CSS extends Test {
8181
}
8282

8383
protected isCached(result: any): boolean {
84-
return Object.prototype.hasOwnProperty.call(result.response.headers, 'cache-control');
84+
return result.response.headers.has('cache-control');
8585
}
8686

8787
protected hasXContentTypeOptionsHeader(result: any): boolean {
88-
return Object.prototype.hasOwnProperty.call(result.response.headers, 'x-content-type-options');
88+
return result.response.headers.has('x-content-type-options');
8989
}
9090

9191
protected isMinified(result: any): boolean {

src/html/Image.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ class Image extends Test {
7373
}
7474

7575
protected isCached(result: any): boolean {
76-
return Object.prototype.hasOwnProperty.call(result.response.headers, 'cache-control');
76+
return result.response.headers.has('cache-control');
7777
}
7878

7979
protected hasXContentTypeOptionsHeader(result: any): boolean {
80-
return Object.prototype.hasOwnProperty.call(result.response.headers, 'x-content-type-options');
80+
return result.response.headers.has('x-content-type-options');
8181
}
8282
}
8383

src/html/JavaScript.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ class JavaScript extends Test {
3131

3232
const result = await request.get(script);
3333

34+
console.log(result.response.headers);
35+
console.log(Object.prototype.hasOwnProperty.call(result.response.headers, 'cache-control'));
36+
console.log('cache-control' in result.response.headers)
37+
console.log(result.response.headers.has('cache-control'))
38+
3439
const isFileAvailabe = {
3540
status: this.isFileAvailable(result) ? 'SUCCESS' : 'ERROR',
3641
title: 'Available',
@@ -88,11 +93,11 @@ class JavaScript extends Test {
8893
}
8994

9095
protected isCached(result: any): boolean {
91-
return Object.prototype.hasOwnProperty.call(result.response.headers, 'cache-control');
96+
return result.response.headers.has('cache-control');
9297
}
9398

9499
protected hasXContentTypeOptionsHeader(result: any): boolean {
95-
return Object.prototype.hasOwnProperty.call(result.response.headers, 'x-content-type-options');
100+
return result.response.headers.has('x-content-type-options');
96101
}
97102

98103
protected isMinified(result: any): boolean {

0 commit comments

Comments
 (0)