Skip to content

Commit e8ddeb4

Browse files
authored
fix: change content type to json (#885)
1 parent a0a3b0d commit e8ddeb4

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

example/e2e/mockServer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ export const startServer = async (mockServerListener) => {
1313
return new Promise((resolve) => {
1414
const app = express();
1515

16-
app.use(bodyParser.text());
16+
app.use(bodyParser.json());
1717

1818
// Handles batch events
1919
app.post('/events', (req, res) => {
2020
console.log(`➡️ Received request`);
21-
const body = JSON.parse(req.body);
21+
const body = req.body;
2222
mockServerListener(body);
2323

2424
res.status(200).send({ mockSuccess: true });

packages/core/src/__tests__/api.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('#sendEvents', () => {
6969
writeKey: 'SEGMENT_KEY',
7070
}),
7171
headers: {
72-
'Content-Type': 'text/plain',
72+
'Content-Type': 'application/json; charset=utf-8',
7373
},
7474
});
7575
}

packages/core/src/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const uploadEvents = async ({
1717
writeKey: writeKey,
1818
}),
1919
headers: {
20-
'Content-Type': 'text/plain',
20+
'Content-Type': 'application/json; charset=utf-8',
2121
},
2222
});
2323
};

0 commit comments

Comments
 (0)