Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3708

django: request.POST is empty

$
0
0

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

<QueryDict: {}>

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


Viewing all articles
Browse latest Browse all 3708

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>