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
1 changed files with 13 additions and 2 deletions

View File

@ -20,6 +20,17 @@ if (log_disabled) {
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) {
if (cache[project_id]) {
let indexes = "";
@ -114,8 +125,8 @@ function diff(current, checked) {
app.post("/updates/:project(\\w+)", (req, res) => {
let project_id = req.params['project'];
const body = req.body || "";
console.log(req.body);
const body = req.rawBody || "";
console.log(req.rawBody);
console.log(`${req.body}, ${typeof req.body}`);
console.log(`${body}`);
let adjustedBody = body.replace(/\r/, "");