(
headers: { get(name: string): string | null } | undefined
)
| 37 | } |
| 38 | |
| 39 | function getContentLength( |
| 40 | headers: { get(name: string): string | null } | undefined |
| 41 | ): number | null { |
| 42 | const rawLength = headers?.get('content-length') |
| 43 | if (!rawLength) return null |
| 44 | const parsed = Number.parseInt(rawLength, 10) |
| 45 | return Number.isFinite(parsed) && parsed >= 0 ? parsed : null |
| 46 | } |
| 47 | |
| 48 | export function assertContentLengthWithinLimit( |
| 49 | headers: { get(name: string): string | null } | undefined, |
no test coverage detected