PyCharm使用技巧:Test RESTful Web Service(RESTful接口测试界面)

来源:互联网 发布:淘宝老年人的冬季帽子 编辑:程序博客网 时间:2024/06/11 21:17

PyCharm的Test RESTful Web Service工具提供了RESTful接口测试界面,如下图所示,提供了get、post,put等http方法,其中的Request子界面headers,Parameters,Body等功能,Response子界面用于显示返回值,Response Headers用于显示返回的消息头。


进入: Tools-> Test RESTful Web Service


我们以下面的Flask代码来简单介绍RESTful接口测试界面:

main.py

from flask import Flask, requestapp = Flask(__name__)@app.route('/hello')def index():    data = request.args.get('data')    return 'hello world: ' + dataif __name__ == '__main__':    app.run()


测试步骤:

1.运行main.y

2.按照上图输入Host/Port,Path,Parameters

3.点击左边的小三角开始测试。

4.查看Response和Response Headers界面(见下图)






原创粉丝点击