aryzing
aryzing9mo ago

How to limit payload size?

Is there a way to limit the payload size? E.g., if a particularly large JSON payload is sent to the (standalone) server, the server should stop after having read a set number of bytes and fail the request.
1 Reply
aryzing
aryzing9mo ago
Seems a raw Node.js server would work with something similar to the following, however the 'data' event inside createContext is not firing
opts.req.on("data", (chunk) => {
console.log("Received chunk with size: ", chunk.size);
});
opts.req.on("data", (chunk) => {
console.log("Received chunk with size: ", chunk.size);
});
Is the data already received by the time createContext is ran?