Request.data empty when request is sent by Insomnia

I just want to update the "name" attribute via API, but when I make the request through Insomnia, data appears as an empty dictionary. Why "name" is not in request.data?

Below is the Insomnia JSON request: (method = PATCH)

{
   "name": "name_test"
}

Everything is working well, but when I access the data dictionary from request it's empty. See below in the image:

enter image description here

Below is the code of backend API

   def partial_update(self, request, pk=None):
        try:
            flow = Flow.objects.get(pk=pk)
            if "name" in request.data and request.data["name"]:
                flow.name = request.data["name"]
            flow.save()
            return Response({"Response": "Object changed successfully"})
        except Exception as e:
            return Response({"Response": str(e)})

Any suggestions about why data is empty? The JSON format is wrong?

Back to Top