MCPcopy
hub / github.com/browserless/browserless / readBody

Function readBody

src/utils.ts:385–400  ·  view source on GitHub ↗
(
  req: Request,
  maxSize: number = 10485760,
)

Source from the content-addressed store, hash-verified

383};
384
385export const readBody = async (
386 req: Request,
387 maxSize: number = 10485760,
388): Promise<ReturnType<typeof safeParse>> => {
389 if (
390 typeof req.body === 'string' &&
391 (isBase64Encoded(req.body) || req.body.startsWith('{'))
392 ) {
393 return safeParse(convertIfBase64(req.body));
394 }
395 const body = await readRequestBody(req, maxSize);
396
397 return req.headers['content-type']?.includes(contentTypes.json)
398 ? safeParse(body)
399 : body;
400};
401
402/**
403 * Lists the path of Chromes (stable) install since

Callers 1

handleRequestUnsafeMethod · 0.85

Calls 4

isBase64EncodedFunction · 0.85
safeParseFunction · 0.85
convertIfBase64Function · 0.85
readRequestBodyFunction · 0.85

Tested by

no test coverage detected