I’m sending data from Javascript like this:
let payload = {
cmd: document.getElementById('cmdInput').value
}
console.log('Sending payload', payload)
fetch('/runNgen/',
{
method: "POST",
body: JSON.stringify(payload),
headers: {
"Content-Type": "application/json"
}
})
The Post operation seems to work. But on the Django side, I have
@api_view(['POST'])
def run_ngen(request):
print("params", request.POST.keys())
and the parameters are empty. What am I doing wrong?