今天在Pycharm Professional 2020下使用Tools里面的Test RESTful Web Service工具的时候,发现除了问题。软件提示:This REST client is deprecated.
使用它调试POST方法时,发现一直出错,提示500 Internal Server Error。里面的提示是:
django.db.utils.IntegrityError: (1048, "Column 'b_name' cannot be null")
[21/Jun/2020 21:40:04] "POST /api/books/?b_name=Gone+with+the+wind&b_price=9.9 HTTP/1.1" 500 208473
后来发现这个是Pycharm的问题,它把POST的信息打在了url上,所以就一直导致错误。
得到的经验就是不能再使用Pycharm软件里的Test RESTful Web Service工具了,需要使用Postman。
Postman的下载网址:https://www.postman.com/downloads/
下载、安装、注册以后,可以按着图中所示的进行设置并查看结果。