aryzing
aryzing14mo 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
aryzingOP14mo 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?

Did you find this page helpful?