TIL day-61 DRF docs

yo·2020년 9월 1일
0

Requests

request.data
-returns the parsed content of the request body
-similar to request.POST

Note: If a client sends malformed content, then accessing request.data may raise a ParseError. By default REST framework's APIView class or @api_view decorator will catch the error and return a 400 Bad Request response.

If a client sends a request with a content-type that cannot be parsed then a UnsupportedMediaType exception will be raised, which by default will be caught and return a 415 Unsupported Media Type response.

query_params
-synosym 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.

request.user

request.auth

request.method
-returns the uppercased string representation of the request's HTTP method.

Response

profile
Never stop asking why

0개의 댓글