We are using navigator.sendBeacon function to send data to Koa server, in which we are using bodyparser.
If we not wrapped data into form then by default this function send data as request payload. How I can able to access this data on Koa server?
Example -
navigator.sendBeacon('http://localhost:3000/cookies/', 'test=payload')
At server, request body is blank.

Considering that
Koa does not parse request body, so you need to use either koa-bodyparser or koa-body,
koa-bodyparserby default has onlyjsonandformparsing enabled,From your screenshot, it is clear that
navigator.sendBeaconset theContent-Typetotext,You need to change the Koa server code, so that it parses
textdata.Example:
Tested with
koa
2.7.0,koa-bodyparser
4.2.1.