Modified code to use request.body instead of request.POST