@hutiwephy/ape-express
Version:
Authenticate and Encrypt HTTP with User Credentials (Not TLS-SRP) (ExpressJS Implementation).
21 lines (19 loc) • 417 B
JavaScript
/**
*
* @param {Express.Request} req
* @returns {Promise<Buffer, Error>}
*/
module.exports = function(req){
return new Promise((resolve, reject)=>{
body = [];
req.on("data", (chunk)=>{
body.push(chunk);
});
req.on("end", ()=>{
resolve(Buffer.concat(body));
});
req.on("error", (err)=>{
reject(err);
});
});
};