Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

django: request.POST is empty

I have the following rest API endpoint:

def post(request, *args, **kwargs):
   print(request.POST)
   short_description = request.POST.get("short_description", "")
   long_description = request.POST.get("long_description", "")

   # rest of the code goes here

when I call

response = client.post("/foo/bar/api/v1/error/1", {"short_description": "hello", "long_description": "world", format='json')

it gives me

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<QueryDict: {}>

so both short_description and long_description is empty strings. How can I get that to pass the correct parameters in the POST?

>Solution :

I think the post method in Django will store data in request.body, please check it

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading