mirror of
https://github.com/django/django.git
synced 2025-10-25 22:56:12 +00:00
Added JSON Parser and request.data
This commit is contained in:
@@ -57,6 +57,16 @@ Parses HTML form content (). The ``parse()`` method returns a
|
||||
Parses multipart form content and supports file uploads. The method returns
|
||||
a ``QueryDict`` for ``data`` and an ``MultiValueDict`` for ``FILES``.
|
||||
|
||||
.. class:: JSONParser
|
||||
|
||||
.. attribute:: media_type
|
||||
|
||||
``"application/json"``
|
||||
|
||||
The ``parse()`` method deserializes JSON to a Python dictionary. This is
|
||||
returned for ``data`` and empty ``MultiValueDict`` is provided for ``FILES``.
|
||||
|
||||
|
||||
HttpRequest.Parsers
|
||||
===================
|
||||
|
||||
|
||||
@@ -119,6 +119,15 @@ All attributes should be considered read-only, unless stated otherwise.
|
||||
|
||||
``POST`` does *not* include file-upload information. See :attr:`FILES`.
|
||||
|
||||
.. attribute:: HttpRequest.data
|
||||
|
||||
Similar to :attr:`HttpRequest.POST` but parses the :attr:`HttpRequest.body`
|
||||
with the parsers returned by :attr:`HttpRequest.parsers``. By default this
|
||||
will result in ``application/json`` data being parsed in addition to form
|
||||
data.
|
||||
|
||||
In addition data will be parsed for all :attr:`HttpRequest.method` methods.
|
||||
|
||||
.. attribute:: HttpRequest.COOKIES
|
||||
|
||||
A dictionary containing all cookies. Keys and values are strings.
|
||||
|
||||
Reference in New Issue
Block a user