'not able to recieve body from incoming request get server side props?

i am trying to recieve an incoming post request . I am able to listen to incoming post request but not able to access body parametres..

serverside code

export async function getServerSideProps({req,res}) {
     console.log(req.body)
     return{
         props:{test:"dan"}
     }
}

client request

 fetch('http://localhost:3000/goo', {
    method: 'POST',
    body: {
       name:"dan"
    }
 })

is there anything which i am doing wrong ? please help me on how to access body data?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source