繁体   English   中英

Jmeter 中重定向 URL 中的响应正文错误

[英]Error in Response body in the redirection URL in Jmeter

我正在尝试对主要 URL 执行重定向的项目进行性能测试,并且重定向 URL 返回进一步进行所需的令牌。

我用 Jmeter 记录了脚本,我可以看到主 URL 按预期执行状态代码为“302”的重定向,并且在响应正文中具有“位置”Z099FB995346F31C753E40EDB0F

But when the redirection URL is hit after the main URL as the sub sample, it returns "307 temporary redirection" in response header and an error message in the response body as " java.lang.IllegalArgumentException: Missing location header in redirect for GET "

我在 Neoload 中检查了相同的场景,我注意到在 Neoload 中发送的重定向请求 URL 与在 JMeter 中发送的请求相同,响应 Z099FB995346F31C749F6E40DB0F39 也匹配。 但是 Neoload 能够显示带有预期标记的响应正文。 在 Jmeter 中,它返回了错误消息。

如果相同的请求可以在 Neoload 中工作,有人可以澄清为什么 Jmeter 中没有显示响应正文。 我确保为主要 URL 发送的请求标头/正文没有区别。

我很确定这个问题与 Jmeter 有关,但不确定如何获得正确的响应主体。

也许有不止一个重定向和 JMeter 不遵循它。

您可以在 HTTP 请求采样器中Redirect automatically和/或Follow redirects

在此处输入图像描述

您也可以使用第三方嗅探器工具(如WiresharkFiddler )来检查实际发送了哪些请求,请注意所有内容:URL、标题、正文等。

It should also be possible to disable handling redirects in JMeter completely and extracting the redirect target from the Location header using Regular Expression Extractor or Boundary Extractor and manually add the next request giving the extracted URL in the "Path" field of the HTTP Request sampler

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM