8.7 【绝佳工具 03】HTTP接口调试:Test RESTful Web Service¶

PyCharm 的 Test RESTful Web Service工具提供了RESTful接口测试界面,如下图所示,提供了get、post,put等http方法,其中的Request子界面headers,Parameters,Body等功能,Response子界面用于显示返回值,Response Headers用于显示返回的消息头。
为了演示,我先使用 Flask 写一个 HTTP 接口
from flask import Flask, request
app = Flask(__name__)
@app.route('/hello')
def index():
name = request.args.get('name')
return '你好,' + name
if __name__ == '__main__':
app.run()
并运行它开启服务,访问地址是:http://127.0.0.1:5000/

通过下图方式打开 Test RESTful Web Service

会出现如下界面,在红框处填写如下信息

然后点击最左边的运行按钮,即可向服务器发送 http 请求。
