Skip to content

Commit

Permalink
Fixed semgrep for comparison endpoint (#1494)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmay-browserstack authored Jan 15, 2024
1 parent eba0481 commit 6a344f1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/core/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,15 @@ export function createPercyServer(percy, port) {
}, { snake: true }))
].join('');

return res.json(200, Object.assign({ success: true }, req.body ? (
Array.isArray(req.body) ? { links: req.body.map(link) } : { link: link(req.body) }
) : {}));
const response = { success: true };
if (req.body) {
if (Array.isArray(req.body)) {
response.links = req.body.map(link);
} else {
response.link = link(req.body);
}
}
return res.json(200, response);
})
// flushes one or more snapshots from the internal queue
.route('post', '/percy/flush', async (req, res) => res.json(200, {
Expand Down

0 comments on commit 6a344f1

Please sign in to comment.