Content-Type|Content-Type header is "text/html", not "application/json"
报错
DRF运行报错 ValueError: Content-Type header is "text/html", not "application/json"
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\17293\Desktop\Coder\Python\Django\twitter\newsfeeds\api\tests.py", line 41, in test_list
print(response.json())
File "C:\Users\17293\AppData\Local\Programs\Python\Python39\lib\site-packages\django\test\client.py", line 662, in _parse_json
raise ValueError(
ValueError: Content-Type header is "text/html", not "application/json"----------------------------------------------------------------------
Ran 1 test in 0.362sFAILED (errors=1)
Destroying test database for alias 'default'...
【Content-Type|Content-Type header is "text/html", not "application/json"】报错原因和解决办法:
去
urls.py
文件中添加路由配置推荐阅读
- EditText默认不获取焦点弹出键盘
- OpenCV|OpenCV for Unity 通过WebCamTextureToMatHelper帮助类来获取摄像头的画面
- ContextCompat
- react-native中Text包含Image大小问题
- 词向量|词向量 Word2Vec, Glove, FastText
- (HTML小白)如何查看浏览器header
- text|text response
- sublimetext|sublimetext 配置
- Sublime|Sublime Text3 快捷键总结
- 同时注册多个|同时注册多个 vue 自定义指令 —— require.context