We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4143aac commit bbe2191Copy full SHA for bbe2191
lighthouse-core/audits/dobetterweb/uses-http2.js
@@ -43,10 +43,11 @@ class UsesHTTP2Audit extends Audit {
43
44
// Filter requests that are on the same host as the page and not over h2.
45
const resources = networkRecords.filter(record => {
46
+ // test the protocol first to avoid (potentially) expensive URL parsing
47
+ const isOldHttp = /HTTP\/[01][\.\d]?/i.test(record.protocol);
48
+ if (!isOldHttp) return false;
49
const requestHost = new URL(record._url).host;
- const sameHost = requestHost === finalHost;
- const notH2 = /HTTP\/[01][\.\d]?/i.test(record.protocol);
- return sameHost && notH2;
50
+ return requestHost === finalHost;
51
}).map(record => {
52
return {
53
protocol: record.protocol,
0 commit comments