#32189: test.client.AsyncClient request POST failing
-------------------------------+--------------------------------------
     Reporter:  perryjrandall  |                    Owner:  nobody
         Type:  Bug            |                   Status:  closed
    Component:  Uncategorized  |                  Version:  master
     Severity:  Normal         |               Resolution:  invalid
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  1              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by Carlton Gibson):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 This is expected behaviour. It's exactly the same using the synchronous
 `Client`.

 `request.POST` is not populated for non-form requests, where
 [https://docs.djangoproject.com/en/3.1/ref/request-
 response/#django.http.HttpRequest.body you should use `request.body`]

 Adjusting the view in your test case:

 {{{
 from json import loads

 async def async_generic_view(request):
        parsed_body = loads(request.body)
        return JsonResponse(parsed_body)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32189#comment:1>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.076c3dff3e3fecfb28aa7525ed8263ab%40djangoproject.com.

Reply via email to