Eggjs bodyparser did not take effect.

egg document says that egg comes with middleware bodyparser

then I posted an object in post body

like:

clipboard.png

 const { body } = ctx.request.body;
 console.log(typeof body); // return string 
Mar.05,2021

Content-Type is not set correctly.
x-www-form-urlencoded is passed to body-parser and parsed is a key-value key-value pair, and value is a string.
this is your

.

bodyparser

header: application/json

body:Raw
   {
     // something
   }
Menu