Django rest framework response.get(';X-Frame-Options';)不是None:当传递两个以上的查询参数时

Django rest framework response.get(';X-Frame-Options';)不是None:当传递两个以上的查询参数时,django-rest-framework,query-parameters,x-frame-options,Django Rest Framework,Query Parameters,X Frame Options,我正在尝试通过DRF进行GET API调用 我的URL如下所示: 但它产生了一个错误: if response.get('X-Frame-Options') is not None: AttributeError: 'NoneType' object has no attribute 'get' 但当我只发送两个查询参数时: http://127.0.0.1:8000/patha/pathb/pathc/pathd/cd007b?name=IT&size=20 或者

我正在尝试通过DRF进行GET API调用

我的URL如下所示:

但它产生了一个错误:

   if response.get('X-Frame-Options') is not None:
   AttributeError: 'NoneType' object has no attribute 'get'
但当我只发送两个查询参数时:

  http://127.0.0.1:8000/patha/pathb/pathc/pathd/cd007b?name=IT&size=20
或者,这三个参数中的两个参数的任意组合都将到达view方法

我的视图方法如下所示:

 class MyRtList(generics.ListAPIView, customMixin):
 ...
 # Here I'd like to use all three inputs:
 # cd007b
 # `name` and `size`
和url.py:

    url(r'patha/pathb/pathc/(?P<name>[^/]+)?$',views.MyRtList.as_view()),    
url(r'patha/pathb/pathc/(?P[^/]+)?$”,views.MyRtList.as_view(),
我正在看医生。使用param1和param2显示的示例。 是否最多使用两个查询参数? 是否禁止使用cd007b和查询参数等混合数据? 因为它被3个参数卡住了,而不是2个参数


哪里出了问题?

你找到了解决办法吗?我也遇到了同样的问题。不涉及DRF。我有一个django测试客户端的测试以这种方式失败。好吧,在我的例子中,问题是,我试图从django视图中的
responses
模块返回模拟响应。原因是我试图通过django.view转发来自
requests.get
的响应。解决方案是创建一个具有相同内容/状态的新响应。。。