request = self.initialize_request(request, *args, **kwargs)python
class Test(APIView): def get(self, request, *args, **kwargs): # url拼接的參數 print(request._request.GET) # 二次封裝方式 print(request.GET) # 兼容 print(request.query_params) # 拓展,兼容性最強 return Response('drf get ok') def post(self, request, *args, **kwargs): # # 全部請求方式攜帶的數據包 print(request._request.POST) # 二次封裝方式 print(request.POST) # 兼容 print(request.data) # 拓展,兼容性最強,三種傳參方式均可以:form-data,urlencoding,json return Response('drf post ok')