Skip to content

Commit

Permalink
Update sendData.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jfoclpf committed Jun 20, 2024
1 parent 24e5dce commit b939691
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/server/middlewares/sendData.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ module.exports = ({ configs, counters }) =>
res.sendData = async function (data) {
debug(req.accepts(['html', 'json']))

counters.incrementCounters()
// don't count for Google Bots/Crawlers when that info is available
if ('isGoogleCrawler' in res.locals) {
if (!res.locals.isGoogleCrawler) {
counters.incrementCounters()
}
} else {
counters.incrementCounters()
}

const dataToBeSent = data.error ? { erro: data.error } : data.data

Expand Down

0 comments on commit b939691

Please sign in to comment.