Skip to content

Commit

Permalink
Fixed semgrep for comparison endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmay-browserstack committed Jan 15, 2024
1 parent 80549bd commit 80c2538
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 80c2538

Please sign in to comment.