Jmeter JSON格式后处理器破坏了令牌检索 [英] Jmeter JSON Format Post Processor breaks Token retrieval

查看:101
本文介绍了Jmeter JSON格式后处理器破坏了令牌检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与Jmeter合作,我想格式化JSON结果.因此,我安装了JSON格式后处理器并将其添加到项目的根目录.

I am working with Jmeter and i want to format the JSON results. So i installed JSON Format Post Processor and added it to the root of the project.

它可以正常工作,它格式化JSon响应以便于阅读.但是,还有一个要求使用令牌认证的请求.不适用于JSON格式后处理器.

It works correctly, it formats the JSon response for easy readability. However there is also a request with requires Token authentication. It does not work with the JSON Format Post Processor.

示例:

在没有JSON格式后处理程序的情况下正确找回硬币:

Correct coin retrieval without JSON Format Post Processor:

{"access_token":"Secret","expires_in":3600,"token_type":"Bearer"}

并且:

{
    "access_token": "Secret",
    "expires_in": 3600,
    "token_type": "Bearer"
}

我使用regulair提取器提取令牌:access_token":"([a-zA-Z0-9.\-\_]*)

I use a regulair extractor to extract the token: access_token":"([a-zA-Z0-9.\-\_]*)

这似乎与格式化程序结合使用.所有请求中都没有拒绝有效的令牌访问

This seems to break in combination with the formatter. No valid token access is denied in all requests

有没有解决这个问题的简单方法?看来我可以为我的整个项目使用Jmeter JSON格式后处理器,也可以根本不使用.

Is there an easy way around this? It seems i can either use Jmeter JSON Format Post Processor for my complete project, or not at all.

有人知道我该如何处理吗?

Anyone know how i deal with this?

推荐答案

似乎您在:

正则表达式:

access_token":(\s*)"([a-zA-Z0-9.\-\_]*)

更改模板以使用$2$

这篇关于Jmeter JSON格式后处理器破坏了令牌检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆