![]() Use different authentication policies for different parts of your API.REST framework provides flexible, per-request authentication, that gives you the ability to: The renderer instance that was selected by the content negotiation stage.accepted_media_typeĪ string representing the media type that was accepted by the content negotiation stage. This allows you to implement behaviour such as selecting a different serialization schemes for different media types.accepted_renderer The request exposes some properties that allow you to determine the result of the content negotiation stage. 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. By default REST framework's APIView class or decorator will catch the error and return a 400 Bad Request response. ![]() Note: If a client sends malformed content, then accessing request.data may raise a ParseError. You won't typically need to access this property. The APIView class or decorator will ensure that this property is automatically set to a list of Parser instances, based on the parser_classes set on the view or based on the DEFAULT_PARSER_CLASSES setting. Doing so will help keep your codebase more correct and obvious - any HTTP method type may include query parameters, not just GET requests.parsers Request.query_params is a more correctly named synonym for request.GET.įor clarity inside your code, we recommend using request.query_params instead of the Django's standard request.GET. For example you can handle incoming JSON data similarly to how you handle incoming form data.įor more details see the parsers documentation.query_params
0 Comments
Leave a Reply. |