#29082: Make the test client automatically encode JSON data --------------------------------------+------------------------------------ Reporter: Nick | Owner: nobody Type: Cleanup/optimization | Status: new Component: Testing framework | Version: 2.0 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------------+------------------------------------
Comment (by Jonas Haag): How about adding a new `json` parameter as in python-requests? From their docs: {{{ >>> url = 'https://api.github.com/some/endpoint' >>> payload = {'some': 'data'} >>> r = requests.post(url, json=payload) }}} Dealing with requests regularly (and I'm sure I'm not the only one in the Python web world who does that) this has become the natural way to specify a JSON request body for me. On multiple occasions I just assumed there was a `json` parameter on the test client just to be disappointed :) -- Ticket URL: <https://code.djangoproject.com/ticket/29082#comment:11> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/064.723cf8282b7feacdee90e0811d1553dd%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.