i am dying on an immeasureable number of levels

This commit is contained in:
jane 2021-06-06 02:10:39 -04:00
parent f307e37519
commit 883655717f

View file

@ -20,6 +20,17 @@ if (log_disabled) {
app.use("/files", express.static("projects")); app.use("/files", express.static("projects"));
app.use(function myMiddleware(req, res, next) {
req.rawBody = '';
req.on('data', function (chunk) {
req.rawBody += chunk;
});
// call next() outside of 'end' after setting 'data' handler
next();
});
function get_indexes(project_id) { function get_indexes(project_id) {
if (cache[project_id]) { if (cache[project_id]) {
let indexes = ""; let indexes = "";
@ -114,8 +125,8 @@ function diff(current, checked) {
app.post("/updates/:project(\\w+)", (req, res) => { app.post("/updates/:project(\\w+)", (req, res) => {
let project_id = req.params['project']; let project_id = req.params['project'];
const body = req.body || ""; const body = req.rawBody || "";
console.log(req.body); console.log(req.rawBody);
console.log(`${req.body}, ${typeof req.body}`); console.log(`${req.body}, ${typeof req.body}`);
console.log(`${body}`); console.log(`${body}`);
let adjustedBody = body.replace(/\r/, ""); let adjustedBody = body.replace(/\r/, "");