Skip to content

Commit

Permalink
Fix "age" header check in XHR loader
Browse files Browse the repository at this point in the history
Fixes regression introduced in #3685 in response to #3680
Resolves #3680
  • Loading branch information
Rob Walch committed Apr 13, 2021
1 parent 4234e65 commit 03f473b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/xhr-loader.ts
Expand Up @@ -8,6 +8,8 @@ import type {
} from '../types/loader';
import { LoadStats } from '../loader/load-stats';

const AGE_HEADER_LINE_REGEX = /^age:\s*[\d.]+\s*$/m;

class XhrLoader implements Loader<LoaderContext> {
private xhrSetup: Function | null;
private requestTimeout?: number;
Expand Down Expand Up @@ -253,7 +255,7 @@ class XhrLoader implements Loader<LoaderContext> {
let result: number | null = null;
if (
this.loader &&
this.loader.getAllResponseHeaders().indexOf('age') >= 0
AGE_HEADER_LINE_REGEX.test(this.loader.getAllResponseHeaders())
) {
const ageHeader = this.loader.getResponseHeader('age');
result = ageHeader ? parseFloat(ageHeader) : null;
Expand Down

0 comments on commit 03f473b

Please sign in to comment.