mirror of
https://github.com/cloudflare/vinext.git
synced 2026-09-14 19:04:59 +08:00
f360380112
* Fix Pages API parsing parity * Fix Pages API body parsing parity * Fix empty form body parity * Regenerate entry-templates snapshots after merge * fix: propagate statusText through prod server sendCompressed non-compressed path The sendCompressed function had a statusText parameter but only used it in the compressed response path. The non-compressed else branch called res.writeHead directly without forwarding statusText, so short error responses (like 'Invalid JSON' at 12 bytes, well below COMPRESS_THRESHOLD) lost their custom reason phrase and fell back to the default 'Bad Request'. Fix: replace the direct res.writeHead call in the else branch with the writeHead closure that already handles the statusText conditional. Also set statusText on the ApiBodyParseError response in the pages server entry template so the value is present for prod-server to forward. --------- Co-authored-by: James <james@eli.cx>
6 lines
175 B
TypeScript
6 lines
175 B
TypeScript
import type { NextApiRequest, NextApiResponse } from "next";
|
|
|
|
export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
res.status(200).json(req.body);
|
|
}
|