Fix body limit
parent
8c8cea6eb6
commit
8d66083f18
5
index.js
5
index.js
|
@ -106,7 +106,7 @@ app.get('/printers/:name/jobs', (req, res) => {
|
|||
|
||||
// --- Print API ---
|
||||
|
||||
app.post('/print', bodyParser.raw({ type: '*/*' }), (req, res) => {
|
||||
app.post('/print', bodyParser.raw({ type: '*/*', limit: 10_000_000 }), (req, res) => {
|
||||
const { body, query } = req
|
||||
console.log("Received print job: ", { body, query })
|
||||
|
||||
|
@ -134,9 +134,6 @@ app.post('/print', bodyParser.raw({ type: '*/*' }), (req, res) => {
|
|||
} else if (body.subarray(0, 4).toString() !== "%PDF") {
|
||||
res.status(415).send("Data does not look like a PDF, please send a PDF")
|
||||
return
|
||||
} else if (body.length > 10_000_000) {
|
||||
res.status(413).send("Data too large (limit: 10MB), please send a smaller PDF")
|
||||
return
|
||||
}
|
||||
|
||||
// send print job
|
||||
|
|
Loading…
Reference in New Issue