Middleware to pause streaming of the request body until a receiver is ready.
Problem: if any asychronous operations occur in the middleware stack before the request body is parsed, the body will likely no longer be available. The request body stream must be paused until parsing can be done.
The pause-request-body package provides two simple middleware functions. The
pauser function should be placed early in the middleware stack, before any
middleware that involves asynchronous operations. The
should occur just before the body is parsed. The request body stream will be
paused between the two.
Install the module with:
npm install pause-request-body
//Connect middleware stack:var pause_request_body = ;var app=// ...//.use(other middleware that may include asynchronous operations)//.use(bodyParser or other middleware that parses or loads the body)// ...
//Express middleware stack:var pause_request_body = ;var app = ;app
Copyright (c) 2013 Randy McLaughlin Licensed under the MIT license.