传递"="时遇到麻烦后续请求中的(等号)符号-Jmeter [英] Trouble in passing "=" (equal) symbol in subsequent request - Jmeter

查看:293
本文介绍了传递"="时遇到麻烦后续请求中的(等号)符号-Jmeter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用jmeter. 我的应用程序返回一个带有加密值的URL作为响应,必须作为请求传递该URL才能获得下一页.加密值始终以"="结尾. " http://mycompany.com/enc=EncRypTedValue= ".在将值作为请求传递时,将"="替换为其他字符,例如'%3d'ex" http://mycompany.com/enc=EncRypTedValue%3d ".由于令牌已更改,因此我的应用程序无法处理请求.

I newly started using jmeter. my application returns an url with encryption value as response which has to be passed as request to get the next page. The encryption value always ends with "=" ex. "http://mycompany.com/enc=EncRypTedValue=". while passing the value as request, the "=" is replaced with some other character like '%3d' ex "http://mycompany.com/enc=EncRypTedValue%3d" . Since the token has been changed my application is not serving the request.

推荐答案

与网络标准中的其他语言和环境不同,我花了一些时间来理解这一点.URI(URL)不使用引号或某些转义符来隐藏特殊字符.

It took me a while to understand this, unlike other languages and environments in network standards URIs (URLs) do not use quotes or some escape characters to hide special characters.

相反,需要通过分别编码每个参数来正确编码URL,以构建完整的URL.在JavaScript中,参数的编码/解码分别是使用encodeURIComponent()和decodeURIComponent()完成的.

Instead, a URL needs to be properly encoded by encoding each individual parameter separately in order to build the complete URL. In JavaScript encoding/decoding of the parameters is done with encodeURIComponent() and decodeURIComponent() respectively.

例如,以下内容:

http://example.com/?p1=hello=hi& ; p2 = three = 3

应该在每个参数上使用encodeURIComponent()进行编码,以构建以下内容:

should be encoded using encodeURIComponent() on each parameters to build the following:

http://example.com/?p1=hello%3Dhi& ; p2 = three%3D3

  • 请注意,用于参数p1 = ... p2 =的等号保持不变.
  • 请勿尝试对整个URL进行编码/解码,否则将无法正常工作. :)
  • 不要被浏览器地址栏/字段上显示的内容所迷住,这仅仅是人类友好的字符串,当您将其复制到剪贴板时,浏览器就会对其进行编码.

希望这对某人有帮助.

这篇关于传递"="时遇到麻烦后续请求中的(等号)符号-Jmeter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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