parse-body.ts
This file
Path
test/helpers/parse-body.ts
9 lines · 321 bytes · TypeScript
Last changed by
Require Node.js 22Sindre Sorhusbefore adoptionf1da0fc
History of this fileTake it
The walk stopped after 200 commits: lines older than 37fc250 point at it.
Require Node.js 22Sindre Sorhusbefore adoptionf1da0fc
line 1why, one step back1import {text} from 'node:stream/consumers';Add retry count to `afterResponse` and `beforeError` hooks (#763)Sindre Sorhusbefore adoption37fc250
lines 2–4why, one step back2import type {Request} from 'express';34export const parseJsonBody = async <T = any>(request: Request): Promise<T> => {Require Node.js 22Sindre Sorhusbefore adoptionf1da0fc
lines 5–6why, one step back5 const body = await text(request);6 return JSON.parse(body) as T;Add retry count to `afterResponse` and `beforeError` hooks (#763)Sindre Sorhusbefore adoption37fc250
lines 7–8why, one step back7};8Require Node.js 22Sindre Sorhusbefore adoptionf1da0fc
line 9why, one step back9export const parseRawBody = async (request: Request): Promise<string> => text(request);