token接口的测法
接口一般都有权限的校验,一般是需要登录后才可以调用
对于接口的认证,一般通过两种方式来实现
1、校验用户请求中是否包含某项指定的cookie
2、校验用户的请求的header中是否包含某项指定的字段(token)
案例一:cookie的处理
LR会自动处理cookie,如果需要手动新增cookie,使用web_add_cookie函数
案例二:token的处理
token一般需要手动添加到HTTP信息头中,使用web_add_header函数
先看笔记 token是什么 cookie是什么 https://www.cnblogs.com/zhenyu1/p/10544209.html
Action()
{ web_reg_save_param("token",
"LB=data\":\"",
"RB=\"}",
"Ord=1",
LAST); web_custom_request("post", "Method=POST", "URL=http://localhost:8080/pinter/bank/api/login2", "Body=userName=admin&password=1234", "TargetFrame=", LAST ); web_add_header("testfan-token","{token}"); web_url("query", "URL=http://localhost:8080/pinter/bank/api/query2?userName=admin", LAST ); return ;
}
返回日志如下:
Virtual User Script started at : -- ::
Starting action vuser_init.
Web Turbo Replay of LoadRunner 11.0. for WINXP; build (Aug ::) [MsgId: MMSG-]
Run Mode: HTML [MsgId: MMSG-]
Run-Time Settings file: "C:\Documents and Settings\test\Local Settings\Temp\noname35\\default.cfg" [MsgId: MMSG-]
Ending action vuser_init.
Running Vuser...
Starting iteration .
Starting action Action.
Action.c(): Registering web_reg_save_param was successful [MsgId: MMSG-]
Action.c(): Notify: Transaction "post_json2" started.
Action.c(): Warning -: The header being added may cause unpredictable results when applied to all ensuing URLs. It is added anyway [MsgId: MWAR-]
Action.c(): web_add_header("Content-type") highest severity level was "warning" [MsgId: MMSG-]
Action.c(): Warning: The string '"userName":"test","password":"1234","gender":1,"phoneNum":"110","email":"beihe@163.com","address":"beijing"' with parameter delimiters is not a parameter.
Action.c(): t=691ms: -byte response headers for "http://localhost:8080/pinter/com/register" (RelFrameId=, Internal ID=)
Action.c(): HTTP/1.1 \r\n
Action.c(): Content-Type: application/json;charset=UTF-\r\n
Action.c(): Transfer-Encoding: chunked\r\n
Action.c(): Date: Sat, Mar :: GMT\r\n
Action.c(): \r\n
Action.c(): t=731ms: -byte chunked response overhead for "http://localhost:8080/pinter/com/register" (RelFrameId=, Internal ID=)
Action.c(): \r\n
Action.c(): t=742ms: -byte chunked response overhead for "http://localhost:8080/pinter/com/register" (RelFrameId=, Internal ID=)
Action.c(): \r\n
Action.c(): \r\n
Action.c(): \r\n
Action.c(): t=783ms: -byte chunked response body for "http://localhost:8080/pinter/com/register" (RelFrameId=, Internal ID=)
Action.c(): {"code":"","message":"娉ㄥ唽鎴愬姛","data":null}
Action.c(): Notify: Saving Parameter "msg = 娉ㄥ唽鎴愬姛".
Action.c(): HTML parsing not performed for Content-Type "application/json" ("ParseHtmlContentType" Run-Time Setting is "TEXT"). URL="http://localhost:8080/pinter/com/register" [MsgId: MMSG-]
Action.c(): web_custom_request("post_json") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Action.c(): Notify: Parameter Substitution: parameter "msg" = "娉ㄥ唽鎴愬姛"
Action.c(): Notify: Saving Parameter "sEncoding = 注册成功\x00".
Action.c(): Notify: Parameter Substitution: parameter "sEncoding" = "注册成功\x00"
Action.c(): Notify: Transaction "post_json2" ended with "Pass" status (Duration: 0.7704 Wasted Time: 0.4959).
Ending action Action.
Ending iteration .
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.
token接口的测法的更多相关文章
- 【token接口】-jmeter
token 接口 3步骤 1.登录接口 2.提取登录接口的token 3.http 信息管理头 把提取的cookie传入 就可以了
- ASP.NET Core WebApi基于Redis实现Token接口安全认证
一.课程介绍 明人不说暗话,跟着阿笨一起玩WebApi!开发提供数据的WebApi服务,最重要的是数据的安全性.那么对于我们来说,如何确保数据的安全将会是需要思考的问题.在ASP.NET WebSer ...
- 接入华为应用内支付,验证购买Token接口,返回“rights invalid”
有海外开发者向我们提问:我在应用中集成了华为应用内支付SDK(测试购买订阅型商品),按照文档说明,在服务器去请求验证购买Token接口的时候返回了{"responseCode":& ...
- 如何区别cookie和token?---测试cookie和token接口时先看。
cookie 是什么? cookie--------------在浏览器中的长相?火狐浏览器 ----------------------------------------------------- ...
- Spring Boot web API接口设计之token、timestamp、sign
版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/vbirdbest/article/details/80789817一:token 简介Token:访 ...
- 前后端分离之接口登陆权限token
随着业务的需求普通的springmvc+jsp已经不能满足我们的系统了,会逐渐把后台和前端展示分离开来,下面我们就来把普通的springmvc+jsp分为 springmvc只提供rest接口,前端用 ...
- Java生鲜电商平台-API接口设计之token、timestamp、sign 具体设计与实现
转载:https://www.cnblogs.com/jurendage/p/12653865.html 说明:在实际的业务中,难免会跟第三方系统进行数据的交互与传递,那么如何保证数据在传输过程中的安 ...
- Java生鲜电商平台-API接口设计之token、timestamp、sign 具体架构与实现(APP/小程序,传输安全)
Java生鲜电商平台-API接口设计之token.timestamp.sign 具体设计与实现 说明:在实际的业务中,难免会跟第三方系统进行数据的交互与传递,那么如何保证数据在传输过程中的安全呢(防窃 ...
- API接口设计之token、timestamp、sign 具体架构与实现(APP/小程序,传输安全)
Java生鲜电商平台-API接口设计之token.timestamp.sign 具体设计与实现 说明:在实际的业务中,难免会跟第三方系统进行数据的交互与传递,那么如何保证数据在传输过程中的安全呢(防窃 ...
随机推荐
- [转]解決 IE10 瀏覽器無法使用 ASP.NET 表單驗證登入的問題
今天凌晨在客戶端上線,當程式佈署到正式機後發現我們的網站唯獨只有 IE10 瀏覽器無法成功登入,任何其他瀏覽器版本或使用較低的 IE 版本都可以正常登入,使用 IE 相容性檢視也都可以正常登入,想說會 ...
- HDU 1053 Entropy(哈夫曼编码 贪心+优先队列)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1053 Entropy Time Limit: 2000/1000 MS (Java/Others) ...
- imageNamed和dataWithContentsOfFile的区别(1)
imageNamed和dataWithContentsOfFile的区别 imagecacheuiviewextensionprocessingxcode 最近老是受iphone内存问题的困扰,找了些 ...
- vue路由页面加载的几种方法~
懒加载 (1)定义:懒加载也叫延迟加载,即在需要的时候进行加载,随用随载. (2)为什么需要懒加载: 在单页应用中,如果没有应用懒加载,运用webpack打包后的文件将会异常的大,造成进入首页时,需要 ...
- 数据库函数(Left、Right)
MySQL 字符串截取函数:left(), right(), substring(), substring_index().还有 mid(), substr().其中,mid(), substr() ...
- Vue.js与 ASP.NET Core 服务端渲染功能整合
http://mgyongyosi.com/2016/Vuejs-server-side-rendering-with-aspnet-core/ 原作者:Mihály Gyöngyösi 译者:oop ...
- ES5 实现 ES6 的 class以及extends
ts中是这样的 class Greeter { greeting:string; constructor(message:string){ this.greeting = message; } gre ...
- chromium之lazy_instance
先看看介绍 // The LazyInstance<Type, Traits> class manages a single instance of Type, // which will ...
- mac Axure RP 8 授权码 以及汉化
Koshy wTADPqxn3KChzJxLmUr5jTTitCgsfRkftQQ1yIG9HmK83MYSm7GPxLREGn+Ii6xY 汉化包 汉化包链接 密码: upri 汉化步骤 以Win7 ...
- 基于Bootstrap Ace模板+bootstrap.addtabs.js的菜单
这几天研究了基于bootstrap Ace模板+bootstra.addtabs.js实现菜单的效果 参考了这个人的博客 https://www.cnblogs.com/landeanfen/p/76 ...