Skip to content

Commit

Permalink
If request data is array then no need to spread into object
Browse files Browse the repository at this point in the history
  • Loading branch information
Tooseriuz committed Dec 22, 2023
1 parent 0f92146 commit 42e200d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion common/middleware/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ module.exports = expressWinston.logger({
),
meta: false,
msg: function (req, res) {
let body = { ...req.body }
// stream/:id/detections receive request data as array
// classifier receive request data as object
// we don't want to spread array values into single object
let body = Array.isArray(req.body) ? req.body : { ...req.body }
// shorten long detections body request
if (/streams\/([a-zA-Z]|\d)+\/detections/.test(req.url) && req.body.length > 5) {
const totalLength = body.length
Expand Down

0 comments on commit 42e200d

Please sign in to comment.