flask的代码如下:
#!/usr/bin/env python # -*- coding: utf-8 -*- from flask import Flask, url_for, request app = Flask(__name__) @app.route(‘/login‘, methods=[‘GET‘, ‘POST‘]) def login(): if request.method == ‘POST‘: print(request.form[‘userid‘]) # 获取post穿过来的参数 dict = request.form.to_dict() # 将请求参数解析成字典 print(dict[‘userid‘]) return ‘POST‘ else: print(request.args[‘userid‘]) # 获取get传过来的参数 dict = request.args.to_dict() # 将请求参数解析成字典 print(dict[‘userid‘]) return ‘GET‘ if __name__ == ‘__main__‘: app.run()
运行之后,就可以用jmeter 测试接口了
运行jmeter 查看结果树:
原文地址:https://www.cnblogs.com/111testing/p/10810439.html
时间: 2024-10-29 19:08:20