I'm using postman to create a POST request to my django view
@csrf_exempt
@api_view(['POST'])
def create_user(request):
data = JSONParser().parse(request)
serializer = CaretakerSerializer(data=data)
if serializer.is_valid():
serializer.save()
return JSONResponse(serializer.data, status=201)
return JSONResponse(serializer.errors, status=400)
but I get the following error:
{
"detail": "JSON parse error - No JSON object could be decoded"
}
When trying to print my request.body I get the following:
------WebKitFormBoundaryrg1JNLvBOEfjkQAT
Content-Disposition: form-data; name="name"
Rubencito
------WebKitFormBoundaryrg1JNLvBOEfjkQAT
Content-Disposition: form-data; name="email"
[email protected]
------WebKitFormBoundaryrg1JNLvBOEfjkQAT--
This is the postman screenshot:
