File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ export const startServer = async (mockServerListener) => {
13
13
return new Promise ( ( resolve ) => {
14
14
const app = express ( ) ;
15
15
16
- app . use ( bodyParser . text ( ) ) ;
16
+ app . use ( bodyParser . json ( ) ) ;
17
17
18
18
// Handles batch events
19
19
app . post ( '/events' , ( req , res ) => {
20
20
console . log ( `➡️ Received request` ) ;
21
- const body = JSON . parse ( req . body ) ;
21
+ const body = req . body ;
22
22
mockServerListener ( body ) ;
23
23
24
24
res . status ( 200 ) . send ( { mockSuccess : true } ) ;
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ describe('#sendEvents', () => {
69
69
writeKey : 'SEGMENT_KEY' ,
70
70
} ) ,
71
71
headers : {
72
- 'Content-Type' : 'text/plain ' ,
72
+ 'Content-Type' : 'application/json; charset=utf-8 ' ,
73
73
} ,
74
74
} ) ;
75
75
}
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export const uploadEvents = async ({
17
17
writeKey : writeKey ,
18
18
} ) ,
19
19
headers : {
20
- 'Content-Type' : 'text/plain ' ,
20
+ 'Content-Type' : 'application/json; charset=utf-8 ' ,
21
21
} ,
22
22
} ) ;
23
23
} ;
You can’t perform that action at this time.
0 commit comments