GitHub
-
+
Next
-
+
Previous
Search
@@ -81,36 +81,40 @@
- Home
+ -
+ Home
+
+
-
Tutorial
@@ -121,107 +125,107 @@
@@ -232,55 +236,55 @@
@@ -476,7 +480,7 @@
- It supports parsing the content of HTTP methods other than
POST
, meaning that you can access the content of PUT
and PATCH
requests.
- It supports REST framework's flexible request parsing, rather than just supporting form data. For example you can handle incoming JSON data in the same way that you handle incoming form data.
-
For more details see the parsers documentation.
+
For more details see the parsers documentation.
.query_params
request.query_params
is a more correctly named synonym for request.GET
.
For clarity inside your code, we recommend using request.query_params
instead of the Django's standard request.GET
. Doing so will help keep your codebase more correct and obvious - any HTTP method type may include query parameters, not just GET
requests.
@@ -508,11 +512,11 @@
.user
request.user
typically returns an instance of django.contrib.auth.models.User
, although the behavior depends on the authentication policy being used.
If the request is unauthenticated the default value of request.user
is an instance of django.contrib.auth.models.AnonymousUser
.
-
For more details see the authentication documentation.
+
For more details see the authentication documentation.
.auth
request.auth
returns any additional authentication context. The exact behavior of request.auth
depends on the authentication policy being used, but it may typically be an instance of the token that the request was authenticated against.
If the request is unauthenticated, or if no additional context is present, the default value of request.auth
is None
.
-
For more details see the authentication documentation.
+
For more details see the authentication documentation.
.authenticators
The APIView
class or @api_view
decorator will ensure that this property is automatically set to a list of Authentication
instances, based on the authentication_classes
set on the view or based on the DEFAULT_AUTHENTICATORS
setting.
You won't typically need to access this property.
@@ -522,22 +526,21 @@
.method
request.method
returns the uppercased string representation of the request's HTTP method.
Browser-based PUT
, PATCH
and DELETE
forms are transparently supported.
-
For more information see the browser enhancements documentation.
+
For more information see the browser enhancements documentation.
.content_type
request.content_type
, returns a string object representing the media type of the HTTP request's body, or an empty string if no media type was provided.
You won't typically need to directly access the request's content type, as you'll normally rely on REST framework's default request parsing behavior.
If you do need to access the content type of the request you should use the .content_type
property in preference to using request.META.get('HTTP_CONTENT_TYPE')
, as it provides transparent support for browser-based non-form content.
-
For more information see the browser enhancements documentation.
+
For more information see the browser enhancements documentation.
.stream
request.stream
returns a stream representing the content of the request body.
You won't typically need to directly access the request's content, as you'll normally rely on REST framework's default request parsing behavior.
If you do need to access the raw content directly, you should use the .stream
property in preference to using request.content
, as it provides transparent support for browser-based non-form content.
-
For more information see the browser enhancements documentation.
+
For more information see the browser enhancements documentation.
Standard HttpRequest attributes
As REST framework's Request
extends Django's HttpRequest
, all the other standard attributes and methods are also available. For example the request.META
and request.session
dictionaries are available as normal.
Note that due to implementation reasons the Request
class does not inherit from HttpRequest
class, but instead extends the class using composition.
-