Please, provide an example for getting the body of the request when using fetch method.
// request options
const options = {
method: 'POST',
body: JSON.stringify(myCustomData),
headers: {
'Content-Type': 'application/json'
}
}
// send POST request
fetch(url, options)
.then(res => res.json())
.then(res => console.log(res));
I try
-- display all posted values
for name,value in request:datapairs() do
print(name,'=',value)
end
but the result is empty.
ECMA6 Fetch function is explained here.
Thanks