MCPcopy
hub / github.com/simstudioai/sim / getContentLength

Function getContentLength

apps/sim/lib/core/utils/stream-limits.ts:39–46  ·  view source on GitHub ↗
(
  headers: { get(name: string): string | null } | undefined
)

Source from the content-addressed store, hash-verified

37}
38
39function 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
48export function assertContentLengthWithinLimit(
49 headers: { get(name: string): string | null } | undefined,

Callers 2

Calls 1

getMethod · 0.65

Tested by

no test coverage detected