【发布时间】:2021-10-02 07:21:29
【问题描述】:
我在我的项目中使用rest_framework.test.APIClient 进行单元测试。我使用字典作为请求数据,所以 None 值没有正确解析,因为它不理解格式。我将format="json" 作为参数添加到client.post(),它运行良好。但是添加content_type="application/json" 也解决了这个问题,我想知道有什么区别。
【问题讨论】:
标签: json django django-rest-framework