use text/plain on /api/metrics
This commit is contained in:
parent
b30be6e4a2
commit
8eaacfea18
4 changed files with 11 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
const crypto = require('crypto');
|
||||
const express = require('express');
|
||||
const bodyParser = require('body-parser');
|
||||
const helmet = require('helmet');
|
||||
const uaparser = require('ua-parser-js');
|
||||
const storage = require('../storage');
|
||||
|
@ -69,7 +69,8 @@ module.exports = function(app) {
|
|||
res.set('Cache-Control', 'no-cache');
|
||||
next();
|
||||
});
|
||||
app.use(express.json());
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.text());
|
||||
app.get('/', language, pages.index);
|
||||
app.get('/oauth', language, pages.blank);
|
||||
app.get('/legal', language, pages.legal);
|
||||
|
|
|
@ -2,7 +2,7 @@ const { sendBatch, clientEvent } = require('../amplitude');
|
|||
|
||||
module.exports = async function(req, res) {
|
||||
try {
|
||||
const data = req.body;
|
||||
const data = JSON.parse(req.body); // see http://crbug.com/490015
|
||||
const deltaT = Date.now() - data.now;
|
||||
const events = data.events.map(e =>
|
||||
clientEvent(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue