new learner here. I usually test my GET api with Postman, where I can send a Get request with a JSON body.
I'm trying to do the same using Javascript to send a http GET request with a Body like how we can do in Postman. I've read the MDN on fetch and body but I still don't know how to apply it.
My javascript so far (in a React App) is
const a = fetch(ApiUrl)
.then(response => response.json())
.then(data=>setState(data))
But I don't know where to insert my body property, my body is something like this:
{
"StartDate": "2019-01-16T00:00:00",
"EndDate": "2021-02-16T00:00:00",
"FirstName": "Bart",
"LastName": "Simpson",
"Accounts": {
"Savings": 1234,
"Checkings": 4321,
"Investments": 1234,
}
}
Many thanks.