(value: string, directive: string)
| 164 | } |
| 165 | |
| 166 | function parseNonNegativeInt(value: string, directive: string): number { |
| 167 | const trimmed = unquoteArgument(value); |
| 168 | if (!DIGITS_REGEXP.test(trimmed)) { |
| 169 | throw new SyntaxError( |
| 170 | `Cache-Control: invalid value for ${directive}: "${value}"`, |
| 171 | ); |
| 172 | } |
| 173 | const n = Number(trimmed); |
| 174 | return n > MAX_DELTA_SECONDS ? MAX_DELTA_SECONDS : n; |
| 175 | } |
| 176 | |
| 177 | /** Split by comma but not inside double-quoted strings, respecting RFC 9110 |
| 178 | * §5.6.4 quoted-pairs. Needed for `no-cache` and `private` whose |
no test coverage detected