i am dying on an immeasureable number of levels
This commit is contained in:
parent
f307e37519
commit
883655717f
1 changed files with 13 additions and 2 deletions
15
index.js
15
index.js
|
@ -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/, "");
|
||||||
|
|
Loading…
Reference in a new issue